[英]StatusBar Hidden Issue in IOS 9
I am having one issue using status bar. 我在使用状态栏时遇到了一个问题。 I am using stroyboard id to navigate from
oneviewcontroller
to secondViewcontroller
. 我正在使用stroyboard id从
oneviewcontroller
导航到secondViewcontroller
。 I want to hide second Viewcontroller Status bar, but its not hiding and OneViewcontroller
has status bar not hidden. 我想隐藏第二个Viewcontroller状态栏,但它没有隐藏,而
OneViewcontroller
状态栏没有隐藏。 I am using iOS 9 , Swift 2.2 and Xcode 7.3.1 我正在使用iOS 9,Swift 2.2和Xcode 7.3.1
override func prefersStatusBarHidden() -> Bool {
if statusBarIsVisible {
return false
} else {
return true
}
}
In your secondViewController add this method 在您的secondViewController中添加此方法
override func prefersStatusBarHidden() -> Bool {
return true
}
This will hide status bar on secondViewController 这将隐藏secondViewController上的状态栏
1.Go to Info.plist file 1.转到Info.plist文件
2.Hover on one of those lines and a (+) and (-) button will show up. 2.将鼠标悬停在其中一行上,然后将显示(+)和(-)按钮。
3.Click the plus button to add new key Type in start with capital V and automatically the first choice will be View controller-based status bar appearance. 3.单击加号按钮以大写字母V开头添加新的密钥类型,并且自动选择的第一项将是基于视图控制器的状态栏外观。
4.Add that as the KEY. 4.将其添加为密钥。 Set the VALUE to "NO"
将值设置为“否”
5.Go to you AppDelegate.swift Add the code, inside the method 5.转到您的AppDelegate.swift在方法内部添加代码
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject:AnyObject]?) -> Bool {
application.statusBarHidden = true
return true
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.