旋转后改变modalPresentationStyle

时间:2012-01-22 17:47:24

标签: ipad rotation presentmodalviewcontroller

我需要帮助解决问题。我想在旋转事件后打开时动态更改modalPresentationStyle。 我写这个用于创建模态视图

 ZUITableViewController *ivc = [[ZUITableViewController alloc] init];
    ivc.delegate = self;
    _modalIsShowing = TRUE;
    UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:ivc];
    if (UIInterfaceOrientationIsLandscape(self.interfaceOrientation))
    {
        nc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
        nc.modalPresentationStyle = UIModalPresentationFormSheet;

    }
    else{
        nc.modalPresentationStyle = UIModalPresentationFullScreen;
    }
    [self presentModalViewController:nc animated:YES];
    [ivc release];
    [nc release];

1 个答案:

答案 0 :(得分:0)

废弃if语句UIModalPresentationPageSheet行为正常以开始。

ZUITableViewController *ivc = [[ZUITableViewController alloc] init];
ivc.delegate = self;
_modalIsShowing = TRUE;
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:ivc];
nc.modalPresentationStyle = UIModalPresentationPageSheet;
[self presentModalViewController:nc animated:YES];
[ivc release];
[nc release];