presentModalViewController在iPhone / iPad中无法正常旋转

时间:2010-08-10 20:03:24

标签: iphone cocoa-touch ipad uiviewcontroller

我有一个名为MainViewController的viewController,它有一个UIButton。点按时,此按钮会加载另一个名为ModalSelector的viewController,如下所示:

- (IBAction)showModalSelector:(id)sender {

ModalSelector *modal = [[ModalSelector alloc]
      initWithNibName:@"modalSelector" bundle:nil];
modal.modalPresentationStyle = UIModalPresentationFormSheet;
modal.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
modal.modalInPopover = YES;

modal.issues = issuesForModal;
modal.parent = self;

[self presentModalViewController:modal animated:YES];

[modal.view setFrame:CGRectMake(-80, 20, 700, 400)];

[issuesForModal release];
[modal release];

}

然而,当我在模拟器中旋转设备时,两个视图都没有正确旋转,即使我在两个viewControllers中都有这个:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;

}

如何让它正确旋转?

由于

1 个答案:

答案 0 :(得分:0)

我发现代码没有问题,但是模拟器本身。当我在实际设备上测试时,它可以很好地工作。