在控制器调用恢复状态栏事件
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self restoreStatusBarOrientation];
}
/// 恢复状态栏样式
- (void)restoreStatusBarOrientation
{
SEL selector = @selector(setStatusBarOrientation:);
if ([[UIApplication sharedApplication] respondsToSelector:selector])
{
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIApplication instanceMethodSignatureForSelector:selector]];
UIDeviceOrientation orentation = UIDeviceOrientationPortrait;
[invocation setSelector:selector];
[invocation setTarget:[UIApplication sharedApplication]];
[invocation setArgument:&orentation atIndex:2];
[invocation invoke];
}
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end