开发者

Write some text in (or on) UIStatusBar

I know, it's a strange question ^^,

I would like to know if there is a way to write some text in (or on) the UIStatusBar. In particular I want to write some text on the Status B开发者_Python百科ar when the user press a UIButton.

Thanks!


I'm not sure if you can draw directly into the status bar, but you should be able to draw on top of it in a custom view. You can get the status bar's frame using:

CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];

And you can get the application's main window (presumably the status bar's superview) using:

UIWindow *mainWindow = [[UIApplication sharedApplication] keyWindow];

You should be able to add your custom view directly to the key window in the status bar's frame. For an example of an app that appears to "modify" the status bar, take a look at Reeder.


No, the status bar is a system-controlled element. It's content cannot be modified by a third-party application.


Check out this work in progress: https://github.com/maciekish/APStatusBarExtensions


MTStatusBarOverlay is what you want :

https://github.com/myell0w/MTStatusBarOverlay

Definitely the easier to use !

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜