app to be portaraint and particular screen will be landscape swift
Problem:
I had enabled portrait and landscape in info.plist but i want to enable one screen in landscape allowed and other screens only on portrait.How to achieve that?
Solution:
First you must enable the both portrait and landscape in info.plist.Then add the below code in appdelegate
func application(_ application: UIApplication, supportedInterfaceOrientations
if let vc = UIApplication.topViewControlle
// Only allow portrait (standard behaviour)
print("landscape called")
return .all;
}
print("portrait called")
return .portrait;
}
Then it will be working fine.Happy coding..
Comments
Post a Comment