ios-statusbar

How to set Status Bar Style in Swift 3

青春壹個敷衍的年華 提交于 2019-12-17 02:52:18
问题 I'm using Xcode 8.0 beta 4. In previous version, UIViewController have method to set the status bar style public func preferredStatusBarStyle() -> UIStatusBarStyle However, I found it changed to a "Get ONLY varaiable" in Swift 3. public var preferredStatusBarStyle: UIStatusBarStyle { get } How can provide the style to use in my UIViewController? 回答1: [UPDATED] For Xcode 10+ & Swift 4.2+ This is the preferred method for iOS 7 and higher In your application's Info.plist , set View controller

I am not able to hide statusBar when I try to show a view

烂漫一生 提交于 2019-12-12 06:51:23
问题 I want to hide statusBar when I show a view in screen. func showView() { if let keyWindow = UIApplication.shared.keyWindow{ let view = UIView(frame: keyWindow.frame) view.backgroundColor = UIColor.black keyWindow.addSubview(view) UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 1, options: .curveEaseOut, animations: { view.frame = keyWindow.frame }) { (completedAnimnation) in //hide status bar when view is showed UIApplication.shared

How to set Status Bar Style in Swift 3

放肆的年华 提交于 2019-11-26 15:35:19
I'm using Xcode 8.0 beta 4. In previous version, UIViewController have method to set the status bar style public func preferredStatusBarStyle() -> UIStatusBarStyle However, I found it changed to a "Get ONLY varaiable" in Swift 3. public var preferredStatusBarStyle: UIStatusBarStyle { get } How can provide the style to use in my UIViewController? [UPDATED] For Xcode 10+ & Swift 4.2+ This is the preferred method for iOS 7 and higher In your application's Info.plist , set View controller-based status bar appearance to YES . Override preferredStatusBarStyle ( Apple docs ) in each of your view

How to change the status bar background color and text color on iOS 7?

拈花ヽ惹草 提交于 2019-11-26 01:44:39
问题 My current application runs on iOS 5 and 6. The navigation bar is having an orange color and the status bar is having a black background color with white text color. However, when I run the same application on iOS 7, I observe the status bar looks transparent with the same orange background color as the navigation bar and the status bar text color is black. Due to this I\'m not able to differentiate between the status bar and the navigation bar. How do I make the status bar to look the same