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 關注
- 699 瀏覽
添加回答
舉報
0/150
提交
取消
