简体   繁体   English

更改iOS状态栏

[英]Changing the iOS status bar

I am making an iOS App and I wanted to have the status bar show up for a few seconds, display a message, then change bac to the normal status bar. 我正在制作一个iOS App,我想让状态栏显示几秒钟,显示一条消息,然后将bac更改为正常状态栏。 Is there a solution for this in the sdk? SDK中是否有针对此的解决方案? Has anyone created anything for this? 有没有人为此创造过任何东西?

Here's a Github project that will let you display custom text instead of the status bar. 这是一个Github项目,可让您显示自定义文本而不是状态栏。 It's based on the Mailbox app, which uses the status bar to display mail sync messages. 它基于邮箱应用程序,该应用程序使用状态栏显示邮件同步消息。 Personally I was surprised that the app review team let Mailbox past with this functionality intact, but they did. 我个人感到惊讶的是,应用审核小组让Mailbox完好无损地使用了这个功能,但他们确实如此。

https://github.com/kevingibbon/KGStatusBar https://github.com/kevingibbon/KGStatusBar

在此输入图像描述

I found another one that I have used. 我找到了另一个我用过的。

https://github.com/online204/StatusBarNotification https://github.com/online204/StatusBarNotification

Use uiview animatewithduration. 使用uiview animatewithduration。 Good tutorial to start: http://www.raywenderlich.com/2454/how-to-use-uiview-animation-tutorial 好的教程开始: http//www.raywenderlich.com/2454/how-to-use-uiview-animation-tutorial

Example: 例:

[UIView animateWithDuration:0.5 delay:0.2 options:UIViewAnimationCurveEaseInOut animations:^{
        [[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleBlackOpaque];
//display ur message
    } completion:^(BOOL finished) {

        [UIView animateWithDuration:0.5 delay:delay+1.5 options:UIViewAnimationCurveEaseInOut animations:^{
            [[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleBlackOpaque];
        } completion:^(BOOL finished) {
          //remove your message
        }];
    }];

Hope helps you to start... 希望帮助你开始......

Here is my shot at the statusbar notification, derived from KGStatusBar but with less code and a simpler API. 这是我从KGStatusBar派生而来的状态栏通知的镜头,但是代码更少,API更简单。

Only 5 methods to do the work : 只有5种方法可以完成这项工作:

+ (void)showWithStatus:(NSString*)status barColor:(UIColor*)color andRemoveAfterDelay:(NSNumber *) delay;
+ (void)showWithStatus:(NSString*)status andRemoveAfterDelay:(NSNumber *) delay;
+ (void)showWithStatus:(NSString*)status andBarColor:(UIColor*)color;
+ (void)showWithStatus:(NSString*)status;
+ (void)dismiss;

Have a look : http://alexiscreuzot.com/KAStatusBar/ 看看: http : //alexiscreuzot.com/KAStatusBar/

An alternative solution is to display a secondary status bar underneath: 另一种解决方案是在下面显示辅助状态栏:

iOS: Create a secondary status bar for displaying in-app messages iOS:创建辅助状态栏以显示应用内消息

隐可见

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM