I want to change device orientation for only one UiViewController. My first UiViewController's name is VideoLaunch. I want Landscape orientation in this UiViewController firstly. When I pass another uiviewcontroller I change a static value which name is "is" to different from nil. When i run in debug mode i see
else return UIInterfaceOrientationMaskPortrait
this line runs. But orientation doesn't change.
AppDelegate.m
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
if([VideoLaunch is] == nil)
return UIInterfaceOrientationMaskLandscape;
else return UIInterfaceOrientationMaskPortrait;
}
You need to override the following method
- (BOOL)shouldAutoRotate
return YES for the one where you want allow rotation.
Then, also override supportedDeviceOrientations and specify what you want in there. For example:
- (BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}
and make sure that you allowed orientations correctly in your target's General settings.