简体   繁体   中英

presentModalViewController doesn't rotate properly in iPhone / iPad

I have a viewController called MainViewController, which has a UIButton. When tapped, this button loads another viewController, called ModalSelector like this:

- (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:

- (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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM