Merge pull request #864 from f-person/feat/all-orientations-for-ipad

feat: Enable upside down orientation for iPad
This commit is contained in:
RyanZhao 2023-07-25 16:54:54 +10:00 committed by GitHub
commit 19beff509b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 3 deletions

View File

@ -46,6 +46,10 @@ public class DocumentTileViewController: UIViewController, UITableViewDelegate,
// MARK: - UI
override public var supportedInterfaceOrientations: UIInterfaceOrientationMask {
if UIDevice.current.isIPad {
return .all
}
return .allButUpsideDown
}

View File

@ -44,6 +44,10 @@ class MediaGalleryNavigationController: UINavigationController {
// MARK: - Orientation
public override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
if UIDevice.current.isIPad {
return .all
}
return .allButUpsideDown
}

View File

@ -54,6 +54,10 @@ public class MediaTileViewController: UIViewController, UICollectionViewDataSour
// MARK: - UI
override public var supportedInterfaceOrientations: UIInterfaceOrientationMask {
if UIDevice.current.isIPad {
return .all
}
return .allButUpsideDown
}

View File

@ -248,7 +248,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
if UIDevice.current.isIPad {
return .allButUpsideDown
return .all
}
return .portrait

View File

@ -140,6 +140,7 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>

View File

@ -13,12 +13,12 @@ NS_ASSUME_NONNULL_BEGIN
BOOL IsLandscapeOrientationEnabled(void)
{
return NO;
return UIDevice.currentDevice.isIPad;
}
UIInterfaceOrientationMask DefaultUIInterfaceOrientationMask(void)
{
return (IsLandscapeOrientationEnabled() ? UIInterfaceOrientationMaskAllButUpsideDown
return (IsLandscapeOrientationEnabled() ? UIInterfaceOrientationMaskAll
: UIInterfaceOrientationMaskPortrait);
}