1 year ago

#315484

test-img

anel

How can I rotate the screen on one view controller?

My app is under development as a hybrid app.

My question is how do I switch from the current view controller to vertical mode?

My main view controller is basically in vertical mode (fixed), and if necessary, I need to change it to horizontal mode.

Override this function and fix it in portrait mode.

override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
          return .portrait 
}

Horizontal mode cannot be changed through the function below.

let value = UIDeviceOrientation.landscapeRight.rawValue
    UIDevice.current.setValue(value, forKey: "orientation")

Can you help me?

ios

swift

rotation

landscape

portrait

0 Answers

Your Answer

Accepted video resources