Reputation: 175
Is there a way in iOS to automatically switch the device in landscape
mode even if i do not support landscape
(deactivated in project settings)?
I have some images. If the user taps one of the images, the image is presented in fullscreen with the content mode UIViewContentModeScaleAspectFit
to keep the aspect ratio. Now all my images are wider than heigh, so i thought it would be better if the device switches to landscape mode when the images is presented fullscreen.
Is this possible if i've deactivated the landscape
mode or is there a workaround, like rotating the image and navigation bar by 90 degree or something?
Upvotes: 0
Views: 154
Reputation: 31311
Try this,
if (self.interfaceOrientation != UIInterfaceOrientationLandscapeRight) {
[[UIDevice currentDevice] performSelector:NSSelectorFromString(@"setOrientation:") withObject:(id) UIInterfaceOrientationLandscapeRight];
}
Upvotes: 1