UIStatusBar iOS上状态栏的自定义颜色
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了UIStatusBar iOS上状态栏的自定义颜色,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3301字,纯文字阅读大概需要5分钟。
内容图文
![UIStatusBar iOS上状态栏的自定义颜色](/upload/InfoBanner/zyjiaocheng/1223/148e18df639e4d1faee1b135b5adb13b.jpg)
App启动时状态栏控制
1、隐藏
![技术分享](/upload/getfiles/default/2022/11/10/20221110011943982.jpg)
![技术分享](/upload/getfiles/default/2022/11/10/20221110011944125.jpg)
2、设置字体颜色为白色
![技术分享](/upload/getfiles/default/2022/11/10/20221110011944259.jpg)
![技术分享](/upload/getfiles/default/2022/11/10/20221110011944409.jpg)
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
App运行时状态栏控制
1、View controller-based status bar appearance : YES 或 info.plist无此条目
UIViewController方法 | 说明 |
- (BOOL)prefersStatusBarHidden NS_AVAILABLE_IOS(7_0); // Defaults to NO | 询问是否隐藏状态栏。 |
- (UIStatusBarStyle)preferredStatusBarStyle NS_AVAILABLE_IOS(7_0); // Defaults to UIStatusBarStyleDefault | 询问状态栏样式(UIStatusBarStyleDefault/UIStatusBarStyleLightContent)。 |
// Override to return the type of animation that should be used for status bar changes for this view controller. This currently only affects changes to prefersStatusBarHidden.
- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation NS_AVAILABLE_IOS(7_0); // Defaults to UIStatusBarAnimationFade
|
询问状态栏显示或隐藏动画。 |
// This should be called whenever the return values for the view controller‘s status bar attributes have changed. If it is called from within an animation block, the changes will be animated along with the rest of the animation block.
- (void)setNeedsStatusBarAppearanceUpdate NS_AVAILABLE_IOS(7_0);
|
设置需要更新状态栏。主动调用该方法,将间接调用上述三个方法。如果需要动画生效,需:
[UIView animateWithDuration:0.4
animations:^{ [self setNeedsStatusBarAppearanceUpdate]; }];
|
2、View controller-based status bar appearance : NO
UIApplication方法/属性 | 说明 |
// Setting statusBarHidden does nothing if your application is using the default UIViewController-based status bar system.
@property(nonatomic,getter=isStatusBarHidden) BOOL statusBarHidden;
- (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation NS_AVAILABLE_IOS(3_2);
|
设置是否隐藏状态栏。 |
// Setting statusBarHidden does nothing if your application is using the default UIViewController-based status bar system.
@property(nonatomic) UIStatusBarStyle statusBarStyle; // default is UIStatusBarStyleDefault
- (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle animated:(BOOL)animated;
|
设置状态栏样式(UIStatusBarStyleDefault/UIStatusBarStyleLightContent)。 |
原文:http://www.cnblogs.com/malikun/p/5620166.html
内容总结
以上是互联网集市为您收集整理的UIStatusBar iOS上状态栏的自定义颜色全部内容,希望文章能够帮你解决UIStatusBar iOS上状态栏的自定义颜色所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。