Question

I want to display a message to the users of my app in the UIStatusBar, but I'd like to maintain the scrollsToTop functionality so a user can tap on the statusbar and scroll a tableView up to the top.

I've looked into adding a UIWindow on top of the current status bar as in this question: Add UIView Above All Other Views, Including StatusBar

But it disables the touches to the status bar.

Note: I've seen several apps that use the statusBar area to display messages such as the "Evernote" app.

Thanks for the help!

Was it helpful?

Solution

Are you hiding the statusBar ? It's unwise to keep it there but draw into its position, because in different countries, with different mobile operators, the statusBar's elements have a little different positions. I've seen app drawing there over status icons. Ugly!

So I guess you want to add a subview at the position of statusBar. Why don't you intercept touch events in that view and send your tableView a message to scroll to the top ?

OTHER TIPS

Have a look at https://github.com/myell0w/MTStatusBarOverlay. By pressing it it can be toggled to not cover the whole status bar and then you can toch the status bar and get back the scroll-to-top feature.

Here is a screenshot, the left side shows the expanded version, the right side the shrinked one:

MTStatusBarOverlay

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top