Fah*_*kar 3 objective-c ios uistatusbar
黑色
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
Run Code Online (Sandbox Code Playgroud)
白色
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
Run Code Online (Sandbox Code Playgroud)
但是我想知道我可以设置一些其他颜色吗?真的我想要这个,因为我的所有应用程序设计都变得丑陋,白色和黑色;(
我知道这是不可能的,但仍然在这里问,有人可能知道是否有办法.
现在,如果没有办法,我计划的是创建自定义视图并将我在状态栏中看到的所有内容放到我的视图中,如下所示,但是从黑到绿.

有什么方法可以收集状态栏的所有信息吗?
我将设法根据通知刷新视图,但我想找到我们可以收集状态栏的所有内容的方式.
最重要的是,是否允许?
我想要的是如下.

从MidhunMP提供的链接,我使用如下.
/// sets the status bar text color. returns YES on success.
/// currently, this only
/// works in iOS 7. It uses undocumented, inofficial APIs.
BOOL setStatusBarColor(UIColor *color)
{
id statusBarWindow = [[UIApplication sharedApplication] valueForKey:@"statusBarWindow"];
id statusBar = [statusBarWindow valueForKey:@"statusBar"];
SEL setForegroundColor_sel = NSSelectorFromString(@"setForegroundColor:");
if([statusBar respondsToSelector:setForegroundColor_sel]) {
// iOS 7+
[statusBar performSelector:setForegroundColor_sel withObject:[UIColor colorWithRed:235/255.0 green:116/255.0 blue:35/255.0 alpha:1.0]];
return YES;
} else {
return NO;
}
}
Run Code Online (Sandbox Code Playgroud)
我在2-3个应用程序中使用了上述代码,Apple已批准.
在更新应用程序时,请在注释中提及您正在使用上面的代码(将代码粘贴到注释中,这非常重要.让Apple知道我们正在使用的代码).当我们向Apple展示代码时,他们知道虽然我们正在访问私有api,但我们并没有伤害任何东西.因此,根据我的要求,他们在应用商店中批准了2个应用.应用程序是BaitBite,Lovely Collectibles和Q8Rent
| 归档时间: |
|
| 查看次数: |
1549 次 |
| 最近记录: |