Search code examples
uiscrollviewios6uiscrollviewdelegate

iOS6 ScrollBarShouldScrollToTop not firing/ ScrollView Delegate issue


I am adding a dummy ScrollView to my app to detect a user click on the status bar, to performa an event in my program.. I am creating it in the ViewDidLoad:

//Dummy Scroll is for the tap on status bar to work 

UIScrollView *dummyScrollView = [[UIScrollView alloc] init]; 
dummyScrollView.delegate = self; 
[[self view ] addSubview:dummyScrollView]; 
[[self view] sendSubviewToBack:dummyScrollView];  

I then implement :

 - (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView 
 { 

NSLog(@"scrollViewShouldScrollToTop");
 .
 .
 }

Under all previous versions of IOS this has worked beautifully and flawlessly, yet under iOS 6 the scrollViewShouldScrollToTop never gets called. Is this a bug?? The API says this should still be available as part of the delegate in iOS6, yet under iOS6 on both device and simulator it never executes... Anyone have any idea what is going on?

Still no other TableView or ScrollView, but there is a MAPVIEW?? But the MapView doesn't have a shouldScrollToTop that I can find to set to NO.. so I am still beyond confused why this stopped working under iOS 6...


Solution

  • On iOS 6, only tap the part above scrollview of status bar can fire scrollsToTop event.

    And, that scrollView can't be hidden or 0 alpha.

    But it can be covered. or clear background color.

    So on iOS 6, you need

    dummyScrollView.frame = self.view.bounds;
    dummyScrollView.backgroundColor = [UIColor clearColor];