ios - Restrict orientation per view controller -
i want in each view controller orientation supports , restrict them. tried:
use custom navigation controller in 1 of old posts, doesn't seem work anymore. solution similar ios 6 - (bool)shouldautorotate not getting called navigation controllers pushed viewcontrollers
i tried setting orientation in xamarin ios, app crashes on
rootviewcontroller
.nullreferenceexception
here.furthermore tried ios 8 : restricting orientation on view controller deleted blog shri chakraborty (shrixamarin). here app crashes if use
application:supportedinterfaceorientationsforwindow:
, becauserootviewcontroller
null. solution seems similar how restrict orientation per view controller in ios7 in navigation controller hierarchy
none of solutions seems work. or miss important? how can restrict orientation view controller landscape only, view controller b portrait , view controller c can shown in available orientations?
overriding getsupportedinterfaceorientations()
in view controller should solve problem:
public override uiinterfaceorientationmask getsupportedinterfaceorientations () { return uiinterfaceorientationmask.landscaperight; }
the orientations return here intersected app's allowed orientations (project properties) or allow in app delegate. sure specify all orientations there or maximum set of orientations want support.
see here documentation.
Comments
Post a Comment