IOS7要隐藏状态栏,需要在info.plist文件中添加View controller-based status bar appearance ,并且把值设置为NO。
但是打开相册或相机的时候,状态栏还是透明显示出来了,在网上找了一下解决方案,终于解决了。
在使用了UIImagePickController的controller里或者UIImagePickController的子类里添加如下代码。
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
if (JKIsIOS7OrLater()) {
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
}
}
BOOL JKIsIOS7OrLater(void)
{
if ([[[UIDevice currentDevice] systemVersion] floatValue]>= 7.0) {
return YES;
} else {
return NO;
}
}