ios - How to present ViewController in Landscape mode -
i want present uiview
controller in landscape mode , disable other rotations uiviewcontroller
. tried following, user can still rotate out of landscape.
override func viewdidload() { super.viewdidload() applylandscapeandlock() build() // additional setup after loading view. } override func preferredinterfaceorientationforpresentation() -> uiinterfaceorientation { return uiinterfaceorientation.landscapeleft } override func shouldautorotate() -> bool { return false } override func supportedinterfaceorientations() -> int { return uiinterfaceorientation.landscapeleft.rawvalue } func applylandscapeandlock() { let value = uiinterfaceorientation.landscapeleft.rawvalue uidevice.currentdevice().setvalue(value, forkey: "orientation") }
Comments
Post a Comment