第一句子网 - 唯美句子、句子迷、好句子大全
第一句子网 > ios 去掉底部状态栏 隐藏ios 9中的状态栏

ios 去掉底部状态栏 隐藏ios 9中的状态栏

时间:2022-06-17 07:36:27

相关推荐

ios 去掉底部状态栏 隐藏ios 9中的状态栏

How do you hide the status bar in ios 9?

This is now deprecated:

[UIApplication sharedApplication] setStatusBarHidden:YES];

解决方案

Swift-3

override var prefersStatusBarHidden: Bool {

return true

}

I got the Information From Here

Change func to var

Delete ()

Change -> to :

This works because a computed variable has a getter function, so the function you were implementing before simply turns into the getter function

onwards: simple Thing like

On your info.plist add the following two property for statusBar Hidden

View controller-based status bar appearance (Boolean: NO)

Status bar is initially hidden (Boolean: YES)

By Source

UIStatusBarHidden

UIViewControllerBasedStatusBarAppearance

or

Old answers ! ...

add application.statusBarHidden in didFinishLaunchingWithOptions

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

// Override point for customization after application launch.

application.statusBarHidden = YES;

return YES;

}

and add

in info.plist add this View controller-based status bar appearance set NO

View controller-based status bar appearance = NO

viewcontroller based hidden set

Add method in your view controller.

Objective -C

- (BOOL)prefersStatusBarHidden {

return YES;

}

Swift upto 2

override func prefersStatusBarHidden() -> Bool {

return true

}

(GOOD) .5.17 in iOS 9.0 worked nicely.

Updated Answer

Go to Info.plist file

Hover on one of those lines and a (+) and (-) button will show up.

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. Add that as the KEY.

Set the VALUE to "NO"

Go to you AppDelegate.m for Objective-C (for swift language: AppDelegate.swift)

Add the code, inside the method

For Objective-C:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

[application setStatusBarHidden:YES];

return YES;

}

For Swift:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject:AnyObject]?) -> Bool {

application.statusBarHidden = true

return true

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。