When we are talking about orientation, they are 2 things that come into the picture:
- Device Orientation
- Interface Orientation
As its clear by the name only, Device orientation tells, in which orientation device is, and Interface orientation says in which orientation your app is presenting its interface.
"Client need an update saying whenever user browse photo/ watch video, he need landscape mode too so that when he rotate image or video, it will get full screen."
By this, its clear that you don't need to change interface of your App. What you need is to rotate the image, when device orientation changes.
For that, First thing you should do is, have a look at this method beginGeneratingDeviceOrientationNotifications
Write this to get notified each time when Device orientation is changed [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
Now, in the viewController where you are showing the images/videos, write this
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange) name:UIDeviceOrientationDidChangeNotification object:nil];
In deviceOrientationDidChange
method, rotate the image as per device orientation
Let me know if more info needed..
Edit: There are 4 orientations possible:
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationLandscapeRight &
- UIInterfaceOrientationPortraitUpsideDown
As you said you are using MPMoviePlayerController
, that supports Landscape Mode. Your code should not depend on which orientation the player is supporting, which its not. You should write code in such a way that it should support all the orientation.
So, as I said earlier, In deviceOrientationDidChange
method, rotate the image as per device orientation.
Let me know if still some issues are there.
EDIT 2: First of all uncheck all orientation support (Except portrait one). Now you don't have to change interface orientation in your code. What you have to do is, you have to detect device orientation change & rotate image like this:
myImage.transform = CGAffineTransformMakeRotation(M_PI + M_PI_2);
I don't think you need customNavigationController to do that. Just try the steps I told you with default NavigationController. It's working fine for me for similar app. Try it with a demo application & then do necessary updates in your main App. Still, Let me know if you get stuck somewhere. :)