Skip to content
Browse files

Merge pull request #2136 from vishalduggal/timob-8628-20X

[TIMOB-8628] 2_0_X Call UIViewControllerDelegate methods explicitly for 4.x
  • Loading branch information...
2 parents 0128ca8 + e579705 commit c37243701a81a543b8304f1bd97b02da9a8539a6 @mstepanov mstepanov committed May 4, 2012
Showing with 33 additions and 23 deletions.
  1. +33 −23 iphone/Classes/TiUIiPhoneNavigationGroup.m
View
56 iphone/Classes/TiUIiPhoneNavigationGroup.m
@@ -139,33 +139,43 @@ - (void)navigationController:(UINavigationController *)navigationController will
TiWindowProxy *newWindow = (TiWindowProxy *)[(TiViewController*)viewController proxy];
[newWindow setupWindowDecorations];
[newWindow windowWillOpen];
- //TIMOB-8559. PR 1819 caused a regression that exposed an IOS issue. In IOS 5 and later, the nav controller calls
+ //TIMOB-8559.TIMOB-8628. PR 1819 caused a regression that exposed an IOS issue. In IOS 5 and later, the nav controller calls
//UIViewControllerDelegate methods, but not in IOS 4.X. As a result the parentVisible flag is never flipped to true
- //and the window never lays out. Using this method sets the flag and ensures window goes into layout queue.
- [newWindow parentWillShow];
+ //and the window never lays out. Call them explicitly.
+ if (![TiUtils isIOS5OrGreater]) {
+ [visibleProxy viewWillDisappear:animated];
+ [newWindow viewWillAppear:animated];
+ }
}
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
- TiViewController *wincontroller = (TiViewController*)viewController;
- TiWindowProxy *newWindow = (TiWindowProxy *)[wincontroller proxy];
- BOOL visibleProxyDidChange = NO;
- if (newWindow!=visibleProxy)
- {
- if (visibleProxy != nil && visibleProxy!=root && opening==NO)
- {
- //TODO: This is an expedient fix, but NavGroup needs rewriting anyways
- [(TiUIiPhoneNavigationGroupProxy*)[self proxy] close:[NSArray arrayWithObject:visibleProxy]];
- }
- visibleProxyDidChange = YES;
- [self setVisibleProxy:newWindow];
- }
- [closingProxy close:nil];
- [closingProxy release];
- closingProxy = nil;
- opening = NO;
- if (visibleProxyDidChange) {
- [newWindow windowDidOpen];
- }
+ TiViewController *wincontroller = (TiViewController*)viewController;
+ TiWindowProxy *newWindow = (TiWindowProxy *)[wincontroller proxy];
+ BOOL visibleProxyDidChange = NO;
+ if (newWindow!=visibleProxy)
+ {
+ if (visibleProxy != nil && visibleProxy!=root && opening==NO)
+ {
+ //TODO: This is an expedient fix, but NavGroup needs rewriting anyways
+ [(TiUIiPhoneNavigationGroupProxy*)[self proxy] close:[NSArray arrayWithObject:visibleProxy]];
+ }
+ visibleProxyDidChange = YES;
+
+ //TIMOB-8559.TIMOB-8628. In IOS 5 and later, the nav controller calls
+ //UIViewControllerDelegate methods, but not in IOS 4.X.Call them explicitly
+ if (![TiUtils isIOS5OrGreater]) {
+ [visibleProxy viewDidDisappear:animated];
+ [newWindow viewDidAppear:animated];
+ }
+ [self setVisibleProxy:newWindow];
+ }
+ [closingProxy close:nil];
+ [closingProxy release];
+ closingProxy = nil;
+ opening = NO;
+ if (visibleProxyDidChange) {
+ [newWindow windowDidOpen];
+ }
}

0 comments on commit c372437

Please sign in to comment.
Something went wrong with that request. Please try again.