문제

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!

도움이 되었습니까?

해결책

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 ?

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top