iOS 7中的状态栏和导航栏问题我正在将我的应用程序迁移到IOS 7。为了处理状态栏问题,我添加了以下代码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];}这在正常情况下很正常。如果我正在改变方向(APP只支持景观方向)或呈现任何视图控制器,并取消模型视图控制器,则我的视图控制器对齐发生了更改。状态栏再次重叠我的视图控制器。这段代码根本不起作用。请指导我解决这个状态栏问题。案例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];提前谢谢。
3 回答
犯罪嫌疑人X
TA贡献2080条经验 获得超4个赞
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; // Override point for customization after application launch. self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease]; self.window.rootViewController = self.viewController; if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) { [application setStatusBarStyle:UIStatusBarStyleLightContent]; [application setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade]; self.window.clipsToBounds =YES; self.window.frame =CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20); } [self.window makeKeyAndVisible]; return YES;}
- 3 回答
- 0 关注
- 667 浏览
添加回答
举报
0/150
提交
取消