我正在将应用程序迁移到iOS7。为了处理状态栏问题,我添加了以下代码
if([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0f)
{
CGRect frame = self.navigationController.view.frame;
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
frame.origin.y = 20;
}
else
{
frame.origin.x = 20;
}
[self.navigationController.view setFrame:frame];
}
在正常情况下,这可以正常工作。如果我更改方向(应用程序仅支持横向方向)或显示任何视图控制器并关闭模型视图控制器,则我的视图控制器对齐方式已更改。状态栏再次与我的视图控制器重叠。这段代码根本不起作用。请指导我解决此状态栏问题。
情况2:这就是我展示视图控制器的方式
ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
reader.supportedOrientationsMask = ZBarOrientationMaskLandscape;
else
reader.supportedOrientationsMask = ZBarOrientationMaskPortrait;
[self presentModalViewController:reader animated:YES];
参考:
提前致谢。
修复了IOS 7中状态栏的问题
Finally I fixed the status bar over lap issue using the delta value property in xcode5. First I have increased origin - y 20pxl to all the controller used in the Xib (it seams to be working fine only in IOS 7), after that I set the delta value for all the view controller origin -y to -20 it works fine in both iOS 6 and iOS 7.
Steps to do that.
Xcode 5 provide preview option to view the appearance of the xib in different view based on the OS version.
Choose preview option from assistant editor
Click assistant editor
and choose preview option to preview selected view controller in different version.
view controller view preview option.
in preview you can find the toggle option to preview view in different version. In preview u can feel the status bar issue clearly if its not fixed properly by toggle the version.
解决状态栏问题的三个步骤:步骤1:确保在File inspector中将视图定位为7.0及更高版本。
步骤2:将视图控制器中添加的所有控件的原点-y增加20像素(状态栏的大小)。
步骤3:将所有控件的原点y的增量值设置为-20,只有它会根据版本自动调整。立即使用预览,并会感觉到由于增量值而导致控件自动调整的差异。
修复状态栏问题后,展示模型视图(ZbarSDk控制器)时的问题也将自动修复。
预览画面:
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句