简体   繁体   English

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

[英]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.

相关问题 如何在iPhone / iPad中使用presentModalViewController? - How to use presentModalViewController in iPhone/iPad? 在iPhone中的Application Delegate中,presentmodalviewcontroller无法正常工作 - presentmodalviewcontroller not working properly in Application Delegate in iPhone iPhone:仅在横向上,在第一个addSubview之后,UITableViewController无法正常旋转 - iPhone: In landscape-only, after first addSubview, UITableViewController doesn't rotate properly IOS7 Xcode 5通用应用程序不会在iPhone上旋转,但会在iPad上旋转 - IOS7 Xcode 5 universal app won't rotate on iphone, but will on ipad iPhone:MPMoviePlayerController在iOS 5.0上不旋转 - iPhone: MPMoviePlayerController doesn't rotate on iOS 5.0 position:修复在 iPad 和 iPhone 上不起作用 - position: fixed doesn't work on iPad and iPhone UIDatePicker在iPhone中可以正常显示,但在iPad中则不能 - UIDatePicker shows fine in iPhone but it doesn't in iPad presentModalViewController iPhone - presentModalViewController iPhone 为什么我的 presentModalViewController 方法不起作用 - Why my presentModalViewController method doesn't work 将iphone转换为ipad,但在旋转ipad时屏幕不会自动旋转 - convert iphone to ipad but screen do not auto rotate while rotate the ipad
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM