Dear Team,
Thanks for quick reply. We tried UIViewController.setNeedsUpdateOfSupportedInterfaceOrientations() but not yet rotate the viewcontroller. we used below lines for force rotate while tap button action
var landscape: UIInterfaceOrientationMask = .portrait
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return landscape
}
func forceRotateToLandscape() {
DispatchQueue.main.async {
if #available(iOS 16.0, *) {
self.landscape = .landscape
self.setNeedsUpdateOfSupportedInterfaceOrientations()
} else {
// Fallback on earlier versions
}
}
}
func forceRotateToPortrait() {
if #available(iOS 16.0, *) {
self.landscape = .portrait
setNeedsUpdateOfSupportedInterfaceOrientations()
} else {
// Fallback on earlier versions
}
}
we supported portrait method for my entire app but we forcefully rotate landscape/portrait particular view controller only. Kindly do the needful
Topic:
UI Frameworks
SubTopic:
UIKit