Issue with auto rotation

75 views Asked by At

I am having a MPMoviePlayerView that i am creating programatically.My PlayerView auto rotation works fine with iOS 5 but it do not work in iOS 6 and iOS 7.I had tried adding orientation detection but problem remain same.

Can anyone tell me how can i support auto rotation in iOS 5 ,iOS 6 and iOS 7.

Thanks ,

2

There are 2 answers

0
Mohammad Rabi On

Try to implement this method in AppDelegate:

-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{

}

you can make condition here for both mode.

such as if media player is in full screen then

return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight; otherwise return UIInterfaceOrientationMaskPortrait;

thanks

0
mahesh chowdary On
[[UIApplication sharedApplication] statusBarOrientation];
[[UIDevice currentDevice] orientation];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceRotatedEventList:) name:UIDeviceOrientationDidChangeNotification object:nil];


 -(void)deviceRotatedEventList:(NSNotification*)notification
 {

UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
if(orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight)
{



    //Do your stuff for landscap
}
else if(orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown)

  {

    }

}

//For rotation method write ur code potraite and landscape mode whatever........