Rotate Landscape to Portrait in MPMoviePlayerViewController in ios6 and ios7

186 views Asked by At

In my project i press done button in video player then player dismiss but view stay in landscape mode. but i want all view in my apps in portrait . Only video player move both side landscape or Portrait.

I try This link but this not work for me . enter link description here

1: Rotate Portrait to Landscape in pdfreader in ios6 and ios7

enter image description here


First one is player when landscape mode and second when i press done button in player. Please give me solution this problems.

2

There are 2 answers

1
Sunny Shah On

On the ViewController use this method it will automatically move the portaint mode

#import <objc/message.h>


-(void)viewDidAppear:(BOOL)animated{              

   if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {
     objc_msgSend([UIDevice currentDevice], @selector(setOrientation:),    UIInterfaceOrientationPortrait );
    }
 }
0
venky On

I found same difficulties like above you have mentioned. Im not seeing your code. may be you used Tab bar or general Navigation for presenting your video player. In that case refer these links http://www.disalvotech.com/blog/app-development/iphone/ios-6-rotation-solution/,Making one specific class of view controller auto rotate in a tab bar app, but forcing all other classes of view controller to stay portrait