6

Can anybody please tell me how to implement tap on status bar and table view should scroll to top. I also have another scroll view in that view controller for some different purpose.

Thanks in advance

Sundeep Saluja
  • 1,089
  • 2
  • 14
  • 36
  • This i done automatically is it not? – Groot Apr 01 '13 at 10:45
  • @SundeepSaluja Can I know how you solved this because I am also stuck on this . – The iCoder Jul 22 '13 at 12:20
  • @Pavan More This faeture will not work if you have more than one control in your class dxerived from UIScrollView. – Sundeep Saluja Jul 29 '13 at 12:54
  • 1
    @Pavan More This feature will not work by default if you have more then one control derived from UIScrollView in your class. So I wrote custom code for this. By adding a view on window with frame exactly same as that of status bar. And on tap of that view i did my work. I can provide the code if you need?? – Sundeep Saluja Jul 29 '13 at 12:56

1 Answers1

15

If you are having more than one scrollview inside the viewcontroller, you set setScrollsToTop property to YES for the scrollview you want to scroll when user taps status bar. And also set that property to NO for all other scrollviews. If there is only one scrollview/tableview, You don't even need to do this. It will be set automatically.

[myScrollView setScrollsToTop:YES];

[otherScrollview setScrollsToTop:NO];

Gopinathan
  • 181
  • 6
  • Did that,, But was not working for me. Finally got a hack from here http://stackoverflow.com/questions/3753097/how-to-detect-touches-in-status-bar – Sundeep Saluja Apr 01 '13 at 11:07
  • 1
    I encountered this issue when using a slide navigation framework. The menu that appeared from the left (after pressing the hamburger icon) contained a list of menu items in a scroll view. So I had to `setScrollsToTop:NO` on this scroll view for all the sub-views to work correctly! – Patrick Aug 01 '14 at 14:23