iphone - Make 1 UIViewController Landscape Mode -
this question has answer here:
my ios app built in portrait format , want keep way. there 1 screen in landscape only, not portrait can't figure how it.
is there advised?
much appreciated
at first should set orientation on supported interface orientation in xcode project summary. in appdelegate:
- (nsuinteger) application: (uiapplication*) application supportedinterfaceorientationsforwindow: (uiwindow*) window { nsuinteger orientations = uiinterfaceorientationmaskall; if (self.window.rootviewcontroller) { uiviewcontroller* rootviewcontroller = self.window.rootviewcontroller; uiviewcontroller* presented; if ([rootviewcontroller iskindofclass: [uinavigationcontroller class]]) { presented = [[(uinavigationcontroller*) rootviewcontroller viewcontrollers] lastobject]; } else { presented = (uiviewcontroller*) rootviewcontroller; } orientations = [presented supportedinterfaceorientations]; } return orientations; }
then in every uiviewcontroller:
- (nsuinteger) supportedinterfaceorientations { return uiinterfaceorientationmaskportrait; }
in need other orientation should change uiinterfaceorientationmaskportrait uiinterfaceorientationmasklandscapeleft or another.
Comments
Post a Comment