I want to fix only a part of the screen sideways with the ios app.

Asked 2 years ago, Updated 2 years ago, 79 views

We are developing an ios application, and it consists of three pages: TOP, MAIN, and DETAIL. We would like to fix the TOP and MAIN pages vertically and only the DETAIL pages horizontally.Is that possible?

ios storyboard

2022-09-30 11:26

1 Answers

You can override two methods for each UIViewController as follows:

// Return whether to rotate automatically or not
override func shouldAutorotate()->Bool{
    return false
}

// Return viewable screen orientation
override func supportedInterfaceOrients() - > Int {
    // Horizontal (right)
    return Int (UIInterfaceOrientationMask.LandscapeRight.rawValue)
    // For vertical fixation, click here.
    return Int (UIInterfaceOrientationMask.Portrait.rawValue)
}


2022-09-30 11:26

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.