iphone - Force landscape for one view controller ios -


i've looked @ several answers questions similar none of answer worked. have app need portait except 1 photo viewer have. in supported orientations section of targets menu have portrait. how force 1 view landscape. being pushed onto stack nav controller i'm using storyboards control that.

since answer seems hidden in comments of question , since arunmak's answer quite confusing, i'll offer found out:

all had add function custom uiviewcontroller subclass view:

- (nsuinteger)supportedinterfaceorientations {     if ([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiompad) {         // ipad: allow orientations         return uiinterfaceorientationmaskall;     } else {         // iphone: allow landscape         return uiinterfaceorientationmasklandscape;     } } 

note project needs allow orientations (that is: portrait, landscape left, landscape right - never upside down on iphone!).

if want limit or views portrait, need implement above method in every of view controllers (or use common super class , subclass others it) — if limit device orientation in info.plist portrait, app never think of going landscape.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -