简体   繁体   English

如何使旧应用程序状态栏的字体大小与iOS 10中的系统状态栏匹配?

[英]How can I make the font size of the status bar of my old app to match the system status bar in iOS 10?

I have an app developed for iOS 7, and since then I keep updating it for every iOS update till the current iOS 10 version. 我有一个专为iOS 7开发的应用程序,从那时起,我一直在每次更新iOS iOS 10之前都对其进行更新。

I have found that the font size of status bar in my app is slightly larger than that of the system status bar and other newer apps, which make it look dated (Please see the first picture below). 我发现我的应用程序中状态栏的字体大小比系统状态栏和其他较新的应用程序的字体大小略大,这使它看起来过时了(请参阅下面的第一张图片)。

How can I make the status bar of my app looks the same as other newer apps (second picture below)? 如何使我的应用程序的状态栏看起来与其他较新的应用程序相同(下面的第二张图片)?

状态栏我的应用字体大小稍大

字体较小的较新应用的状态栏

  1. Change in info.plist the row View controller-based status bar appearance and set it to NO 更改info.plist中的行基于视图控制器的状态栏外观并将其设置为NO
  2. Change in appDelegate.swift in didFinishLaunchingWithOptions appDelegate.swift更改didFinishLaunchingWithOptions

UIApplication.shared.statusBarStyle = .lightContent

  1. Inside every view controller use this code for auto color support in status bar 在每个视图控制器内部,使用此代码在状态栏中提供自动颜色支持

    override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } 覆盖var preferredStatusBarStyle:UIStatusBarStyle {return .lightContent}

Try to add a LaunchScreen.storyboard in your project, and set it to the "Launch Screen File", and your status bar might be in normal size. 尝试在您的项目中添加LaunchScreen.storyboard,并将其设置为“启动屏幕文件”,状态栏可能大小正常。

在此处输入图片说明

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

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