diff options
-rw-r--r-- | MobileCydia.mm | 22 | ||||
-rw-r--r-- | iPhonePrivate.h | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index 41cc4e7..dd7b14a 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -6747,6 +6747,20 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @implementation CYTabBarController +- (void) didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + + // presenting a UINavigationController on 2.x does not update its transitionView + // it thereby will not allow its topViewController to be unloaded by memory pressure + if (kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber_iPhoneOS_3_0) { + UIViewController *selected([self selectedViewController]); + for (UINavigationController *controller in [self viewControllers]) + if (controller != selected) + if (UIViewController *top = [controller topViewController]) + [top unloadView]; + } +} + - (void) setUnselectedViewController:(UIViewController *)transient { if (kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber_iPhoneOS_3_0) { if (transient != nil) { @@ -6786,6 +6800,14 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { - (void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController { if ([self unselectedViewController]) [self setUnselectedViewController:nil]; + + // presenting a UINavigationController on 2.x does not update its transitionView + // if this view was unloaded, the tranitionView may currently be presenting nothing + if (kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber_iPhoneOS_3_0) { + UINavigationController *navigation((UINavigationController *) viewController); + [navigation pushViewController:[[[UIViewController alloc] init] autorelease] animated:NO]; + [navigation popViewControllerAnimated:NO]; + } } - (NSArray *) navigationURLCollection { diff --git a/iPhonePrivate.h b/iPhonePrivate.h index 788c3c5..8cc997a 100644 --- a/iPhonePrivate.h +++ b/iPhonePrivate.h @@ -296,6 +296,7 @@ typedef enum { @interface UIViewController (Apple) - (void) _updateLayoutForStatusBarAndInterfaceOrientation; +- (void) unloadView; @end @interface UIWindow (Apple) |