Explorar el Código

Allow changing interface orientation on iPad 5.x

Gleb Pinigin hace 12 años
padre
commit
9d3f972b71
Se han modificado 1 ficheros con 12 adiciones y 3 borrados
  1. 12 3
      AspenProject/VLCPlaylistViewController.m

+ 12 - 3
AspenProject/VLCPlaylistViewController.m

@@ -276,17 +276,26 @@
 /* deprecated in iOS 6 */
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
 {
-    return (toInterfaceOrientation == UIInterfaceOrientationPortrait) || (_foundMedia.count > 0);
+    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
+        return YES;
+
+    return (_foundMedia.count > 0) || toInterfaceOrientation == UIInterfaceOrientationPortrait;
 }
 
+// RootController is responsible for supporting interface orientation(iOS6.0+), i.e. navigation controller
+// so this will not work as intended without "voodoo magic"(UINavigationController category, subclassing, etc)
 /* introduced in iOS 6 */
 - (NSUInteger)supportedInterfaceOrientations {
-    return (_foundMedia.count > 0)? UIInterfaceOrientationMaskAll: UIInterfaceOrientationMaskPortrait;
+    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
+        return UIInterfaceOrientationMaskAll;
+
+    return (_foundMedia.count > 0)? UIInterfaceOrientationMaskAllButUpsideDown:
+                                    UIInterfaceOrientationMaskPortrait;
 }
 
 /* introduced in iOS 6 */
 - (BOOL)shouldAutorotate {
-    return (_foundMedia.count > 0);
+    return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) || (_foundMedia.count > 0);
 }
 
 #pragma mark - coin coin