iOS7状态栏字体改为白色
字体 状态栏 改为 IOS7 白色
2023-09-11 14:14:25 时间
方案1:
1,在Info.plist中设置View controller-based status bar appearance为NO
2,修改状态栏的字体颜色为白色:
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
如果只修改某个ViewController,将上面的代码加到ViewDidLoad中
如果需要在全部View中都变色,将上面的代码加到AppDelegate中。
方案2:
1,在Info.plist中设置View controller-based status bar appearance为YES
2,在viewWillAppear中调用RefreshStatusBarStyle设置状态栏颜色
- (void)RefreshStatusBarStyle:(UIStatusBarStyle)barStyle {
NSLog(@"RefreshStatusBarStyle");
mStatusBarStyle = barStyle;
if (IOS_7) {
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
[self preferredStatusBarStyle];
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
}
}
else {
[UIApplication sharedApplication].statusBarStyle = barStyle;
}
}
- (UIStatusBarStyle)preferredStatusBarStyle {
NSLog(@"preferredStatusBarStyle :%@", [self class]);
return mStatusBarStyle;
}
相关文章
- 如何精简Unity中使用的字体文件
- uniapp - 阿里图库字体图标使用
- Word控件Spire.Doc 【字体】教程(1):在 Word 中更改字体颜色
- Aspose.Words for .NET使用文档教程(8):如何获取字体行间距
- 07zTree - 显示自定义字体的树
- 《众妙之门——网页排版设计制胜秘诀》——第3章 设置网页字体的5 项原则和方法3.1 系统地进行网页版式设计
- iOS使用NSMutableAttributedString 实现富文本(不同颜色字体、下划线等)
- SwiftUI iOS 精品工具条组件之 09 支持字体动画滚动工具条(教程含源码)
- ubuntu安装微软雅黑和Consolas字体
- mac 安装字体
- WINDOWS XP 系统显示乱码的解决方法(修改注册表,使用正常字体)
- Qt之字体文件(TTF)
- 《响应式Web设计:HTML5和CSS3实践指南》——2.2节创建自适应的响应式字体
- uniapp nvue开发注意事项:字体设置不生效、背景颜色设置不生效、默认的flex布局、只支持简单class选择器、文本溢出及多行溢出、如何支持border属性
- VS2010/MFC编程入门之四十七(字体和文本输出:CFont字体类)
- Visual Studio Code 内置终端的shell和字体设置,让它和iTerm2一样炫酷
- Swift - 状态栏颜色显示(字体、背景)
- idea2018安装JetBrains Mono字体