Swift - Allow Rotation on iPad Only

后端 未结 5 868
小鲜肉
小鲜肉 2020-12-13 01:51

How could I allow my universal app written in Swift on iOS 8.3 SDK to support only portrait mode on iPhone, but both portrait and landscape mode on iPad?

I know in t

5条回答
  •  甜味超标
    2020-12-13 02:40

    I know in the past this has been done in AppDelegate. How could I do this in Swift?

    The language you use doesn't change the architecture of the application. You do this in Swift the same way you do it in Objective-C, i.e. by implementing:

    optional func application(_ application: UIApplication,
             supportedInterfaceOrientationsForWindow window: UIWindow?) -> Int
    

    in your application delegate.

提交回复
热议问题