iOS Objective开发基础知识点总结(持续更新...)
1、iOS9之后APP必须启用ATS,在info.plist添加
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
2、设置状态栏文本颜色为白色,在info.plist添加
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
同时修改状态栏Style为Light,如下图:
如果需要修改状态栏的背景颜色,在AppDelegate添加如下代码并调用:
- (void)setStatusBarBackgroundColor:(UIColor *)color {
UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
statusBar.backgroundColor = color;
}
}