Thanks @Shubham - Systematix for the answer.
All that I had to do was to remove every code related to autorotating except this method in AppDelegate
:
- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
if ([[window.rootViewController presentedViewController] isKindOfClass: [MPMoviePlayerViewController class]])
{
//NSLog(@"in if part");
return UIInterfaceOrientationMaskAllButUpsideDown;
}
else
{
//NSLog(@"in else part");
return UIInterfaceOrientationMaskPortrait;
}
}
When I did it everything worked like a magic!