[英]presentModalViewController doesn't rotate properly in iPhone / iPad
I have a viewController called MainViewController, which has a UIButton. 我有一个名为MainViewController的viewController,它具有一个UIButton。 When tapped, this button loads another viewController, called ModalSelector like this:
轻按此按钮后,将加载另一个名为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];
} }
However, when I rotate the device in the simulator, neither view rotates properly, even though I have this in both viewControllers: 但是,当我在模拟器中旋转设备时,即使两个viewControllers中都包含此视图,两个视图也无法正确旋转:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
} }
How can I make it rotate properly? 如何使其正确旋转?
Thanks 谢谢
I've discovered there's not a problem with the code, but with the simulator itself. 我发现代码没有问题,但是模拟器本身没有问题。 When I test it on the actual device, it works perfectly.
当我在实际设备上对其进行测试时,它可以完美运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.