Fah*_*kar 1 objective-c ios uistatusbar ios7
对于iOS 7,我有状态栏问题.为此我通过在Appdelegate中使用以下代码解决了它
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleLightContent];
self.window.clipsToBounds =YES;
self.window.frame = CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
self.window.bounds = CGRectMake(0,0, self.window.frame.size.width, self.window.frame.size.height);
}
Run Code Online (Sandbox Code Playgroud)
一切都很完美.
只有它在拍照时才会出问题.
当我打开相机或照片库时,我仍然会看到状态栏,因此我看到了一半导航标题,如下所示.

知道我怎么能克服这个错误?
问题是:
照片库/相机就像上面的图像
如果单击取消,我的视图会自动向上移动20px.
代替:
self.window
Run Code Online (Sandbox Code Playgroud)
用这个:
[[self view] window]
Run Code Online (Sandbox Code Playgroud)
试试这样:
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleLightContent];
self.view.window.clipsToBounds =YES;
self.view.window.frame = CGRectMake(0,20,self.view.window.frame.size.width,self.view.window.frame.size.height-20);
self.view.window.bounds = CGRectMake(0,0, self.view.window.frame.size.width, self.view.window.frame.size.height);
}
Run Code Online (Sandbox Code Playgroud)