2015-03-31 63 views
0

我顯示一個視圖控制器模式與導航控制器在iPad中與自定義大小,但當鍵盤顯示時,視圖控制器的幀大小得到更改。它完美iOS上的7個工作,但在iOS上的8問題與呈現自定義大小ViewController模式在ios 8與鍵盤

代碼運行呈現視圖我有這個問題:

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controllerToShow]; 
navController.modalPresentationStyle = UIModalPresentationFormSheet; 
[[AppDelgate instance].rootViewController presentViewController:navController animated:YES completion:nil]; 

//in opening viewcontroller class frame is set 
    #define view_height 400 
#define view_width 700 

-(void)viewWillAppear:(BOOL)animated{ 

    if ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeLeft || [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeRight) { 
      self.navigationController.view.superview.frame = CGRectMake(162, 200, view_width, view_height); 
    }else { 
     self.navigationController.view.superview.frame = CGRectMake(([AppDelgate instance].rootViewController.view.frame.size.width - 700)/2, 250, view_width, view_height); 
    } 
} 

關於如何解決這個任何想法?

回答

0

加入

-(CGSize)preferredContentSize{ 
    return CGSizeMake(view_width, view_height); 
} 
+0

請標記爲接受的解決它。 – 2015-04-03 10:35:21

0

更改系統視圖的私有視圖層次結構從來就不是一個好主意。

您應該使用現有的自定義演示文稿和轉換技術(UIModalPrestationCustomUIViewControllerTransitioningDelegate)來實現您嘗試使用公共API執行的操作。