OuSS
OuSS

Reputation: 13

Force one viewcontroller to be only landscape

In my swift project i have all my viewcontroller to only portrait and i want only 1 view controller to be only landscape

My settings here

Upvotes: 1

Views: 752

Answers (1)

Sucharu Hasija
Sucharu Hasija

Reputation: 1126

To do this , you have to set the Settings for both portrait and landscape and all the following code in each view controller except in which you want a landscape view

override func shouldAutorotate() -> Bool {
    return false
}

override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
    return UIInterfaceOrientationMask.Portrait
}

For further help check here

Upvotes: 1

Related Questions