简体   繁体   中英

iOS: hide status bar programmatically, method based NOT viewController based

I am trying to hide/show the status bar in iOS 7 (and 6) programmatically, NOT ViewController based but method based.

For example if i press button 1 the status bar disappears, if i press button 2 the status bar appears.

I have tried all combinations here and from google, but all are viewcontroller based so far.

Does anybody have an idea how to do it, method based?

Use the UIApplication methods

  - (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation

on the instance [UIApplication sharedApplication]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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