1. AppDelegate.m中调用系统单利
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
// 获取程序App单例对象
[UIApplication sharedApplication].statusBarHidden = NO;
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
return YES;
}
2. ViewController.m中使用
// iOS7之后系统状态栏的定制是基于视图控制器。
// 配置状态栏显示类型
- (UIStatusBarStyle)preferredStatusBarStyle {
return UIStatusBarStyleLightContent;
}
// 配置状态栏是否隐藏,默认为NO
- (BOOL)prefersStatusBarHidden {
return YES;
}