Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scroll to top of UITableView by tapping status bar

I know there's tons of code out there to scroll a tableview to the top, but I want to do this when the top status bar is tapped, just like in Apple's native apps. Is this possible?

like image 349
iOSDev Avatar asked Aug 23 '11 18:08

iOSDev


1 Answers

You get this for free, but you should check that the scrollsToTop attribute of your UITableView is YES.

When this does NOT work is when you have a UIScrollView (or descendant class like UITextView) object embedded inside another UIScrollView class (like UITableView). In this case, set scrollsToTop on the embedded UIScrollView class to NO. Then the tap-the-status-bar behavior will work.

like image 188
Mark Granoff Avatar answered Nov 10 '22 04:11

Mark Granoff