0
MoveToNewLocViewContoller *move2NewLocVC = [[MoveToNewLocViewContoller alloc] initWithLocItemArray:moveToNewLocArray andSyLocIDArray:syLocIdArray]; 
     [move2NewLocVC setTitle:cell.textLabel.text]; 


     UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:move2NewLocVC]; 
     navController.view.width = PSIsIpad() ? self.view.width : 100; 
     [navController.navigationBar setTintColor:BLUE]; 


     if (navController) { 

      [XAppDelegate.menuInterfaceViewController.stackViewController pushViewController:navController fromViewController:nil animated:YES]; 
      [navController release]; 
      //[viewController release]; 
      [moveToNewLocArray release]; 
      [move2NewLocVC release]; 
     } 

現在我希望上面的導航控制器在我旋轉我的ipad時不能調整大小。我試過 navController.view.autoresizesSubviews = NO;如何避免在自定義容器內的UiNavigationcontroller中調整UITableView的大小(stackedViewcontroller)

這是有效的,但有一個問題,它不允許我的UITableView(MoveToNewLocViewController)滾動到底部。避免調整大小的主要目的是避免重新繪製我的巨大自定義UITableViewcell以適應方向。我知道我必須調整我的UiTableview的方向後,但問題是在哪裏。我試過

-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration {} 

-(void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {} 

它似乎沒有工作。這是因爲我將它插入堆棧容器視圖?

任何幫助將深表謝意。

回答

0

我通過在UIView中包含UITableView,然後將其作爲UIViewController添加到UiNavigationController來解決此問題。當設備旋轉時,我調整了didRotateFrominterfaceOrientation方法中的視圖大小

-(void) didRotateFromInterfaceOrientation: (UIInterfaceOrientation)fromInterfaceOrientation 
    PSStackedViewController *stackController = XAppDelegate.menuInterfaceViewController.stackViewController; 
if([[UIDevice currentDevice] orientation] == UIInterfaceOrientationPortrait || [[UIDevice currentDevice] orientation] == UIInterfaceOrientationPortraitUpsideDown){ 
    [stackController setLargeLeftInset:50 animated:YES]; 
    self.navigationController.navigationBar.frame = CGRectMake(self.navigationController.navigationBar.frame.origin.x, self.navigationController.navigationBar.frame.origin.y, self.view.frame.size.width, self.navigationController.navigationBar.frame.size.height); 
    self.move2NewLocTableView.height = self.view.height; 
} 
if([[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeLeft || [[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeRight) { 
    //self.navigationController.view.frame = self.tableView.frame; 
    [stackController setLargeLeftInset:320 animated:YES]; 
    self.move2NewLocTableView.height = 700; 
} 
相關問題