简体   繁体   中英

Rotate UIView programmatically

I have UIViewController which supports only Portrait orientation.

In this viewController i have MPMoviePlayerController object. By default the movie controller supports both landscape and portrait orientations.

When it is in full screen mode and turned into landscape orientation the main view controller also changes his orientation, after exiting the full screen mode , the main view does not changes his orientation.

If I turn the device to portrait orientation, the main view automatically returns to the right orientation. The problem is that i dont want to rotate the main view even if the device is in landscape orientation.

Is there any way to prevent the main view to change its orientation when the movie controller rotates in full screen mode? or what is the right way to return main view into Portrait orientation.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 

must return NO is iOS 5 or

- (NSUInteger)supportedInterfaceOrientations {
  return UIInterfaceOrientationMaskPortrait;
}

in iOS 6 in your ViewController.

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