From 81628115a7ac1ddd54abee383786a8bf9a0d6585 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Tue, 24 Dec 2013 01:46:34 -0800 Subject: [PATCH] Fix iOS 7 autorotate (need setRootViewController). --- CyteKit/ViewController.mm | 8 ++++++++ MobileCydia.mm | 4 ++++ iPhonePrivate.h | 11 +++++++++++ 3 files changed, 23 insertions(+) diff --git a/CyteKit/ViewController.mm b/CyteKit/ViewController.mm index df2ba616..edd87ca0 100644 --- a/CyteKit/ViewController.mm +++ b/CyteKit/ViewController.mm @@ -112,6 +112,14 @@ extern bool IsWildcat_; return IsWildcat_ || orientation == UIInterfaceOrientationPortrait; } +- (NSUInteger) supportedInterfaceOrientations { + return IsWildcat_ ? UIInterfaceOrientationMaskAll : UIInterfaceOrientationMaskPortrait; +} + +- (BOOL) shouldAutorotate { + return YES; +} + - (void) setPageColor:(UIColor *)color { if (color == nil) { color = [UIColor groupTableViewBackgroundColor]; diff --git a/MobileCydia.mm b/MobileCydia.mm index aa8ad521..8a9590d3 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -9573,6 +9573,8 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi return; [window_ addSubview:[tabbar_ view]]; + if ([window_ respondsToSelector:@selector(setRootViewController:)]) + [window_ setRootViewController:tabbar_]; [[emulated_ view] removeFromSuperview]; emulated_ = nil; [window_ setUserInteractionEnabled:YES]; @@ -10282,6 +10284,8 @@ _trace(); emulated_ = [[[CydiaLoadingViewController alloc] init] autorelease]; [window_ addSubview:[emulated_ view]]; + if ([window_ respondsToSelector:@selector(setRootViewController:)]) + [window_ setRootViewController:emulated_]; [self performSelector:@selector(loadData) withObject:nil afterDelay:0]; _trace(); diff --git a/iPhonePrivate.h b/iPhonePrivate.h index 6f4e7063..37e73d6f 100644 --- a/iPhonePrivate.h +++ b/iPhonePrivate.h @@ -418,6 +418,17 @@ extern float const UIScrollViewDecelerationRateNormal; - (WebFrame *) contentFrame; @end +typedef enum { + UIInterfaceOrientationMaskPortrait = (1 << UIInterfaceOrientationPortrait), + UIInterfaceOrientationMaskLandscapeLeft = (1 << UIInterfaceOrientationLandscapeLeft), + UIInterfaceOrientationMaskLandscapeRight = (1 << UIInterfaceOrientationLandscapeRight), + UIInterfaceOrientationMaskPortraitUpsideDown = (1 << UIInterfaceOrientationPortraitUpsideDown), + UIInterfaceOrientationMaskLandscape = (UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight), + UIInterfaceOrientationMaskAll = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | + UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown), + UIInterfaceOrientationMaskAllButUpsideDown = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight), +} UIInterfaceOrientationMask; + // extern *; {{{ extern CFStringRef const kGSDisplayIdentifiersCapability; extern float const UIWebViewGrowsAndShrinksToFitHeight; -- 2.47.2