iphone - How to set only portrait orientation for view controller in iOS? -
my project has many view controller (.xib file). want: view controller can have portrait orientation. other view controller can have landscape orientation. or view controller can have both portrait , landscape orientation. want view controller have landscape orientation (no portrait orientation). please me. you.
-(bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)tointerfaceorientation { return uiinterfaceorientationisportrait(tointerfaceorientation); }
updated:
you can creating category of uinaviagationcontroller
code .h file is
@interface uinavigationcontroller (autorotation) -(bool)shouldautorotate; -(nsuinteger)supportedinterfaceorientations;
and code .m file is
@implementation uinavigationcontroller (autorotation) -(bool)shouldautorotate { uiinterfaceorientation interfaceorientation = [uiapplication sharedapplication].statusbarorientation; [self.topviewcontroller shouldautorotate]; return yes; } -(nsuinteger)supportedinterfaceorientations { return uiinterfaceorientationmaskall; } @end
Comments
Post a Comment