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;

这可行,但有一个问题,它不允许我的 UITableView(MoveToNewLocViewController) 滚动到底部。避免调整大小的主要目的是避免重绘我巨大的自定义 UITableViewcell 以适应方向。我知道我必须在定向后调整 UiTableview 的大小,但问题是在哪里。我试过

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

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

它似乎不起作用。这是因为我将它插入到堆叠的容器视图中吗?

任何帮助将不胜感激。

4

1 回答 1

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;
} 
于 2012-11-12T21:14:41.997 回答