Permalink
Browse files

For iOS versions under 5.0, force/simulate calls to viewDidAppear & v…

…iewDidDisappear.

Please note that the timing is different than for the calls made by the system and you may need to take that into account.
  • Loading branch information...
1 parent de2e97e commit bd8d7d977db944547fdc3b1f90a7837698f921a6 @gumbright committed Nov 28, 2011
@@ -150,6 +150,10 @@ - (void)maskFadeInComplete:(NSString *)animationID finished:(NSNumber *)finished
{
[overlayDelegate overlayContentDisplayed:self];
}
+ if ([[UIDevice currentDevice].systemVersion floatValue] < 5.0)
+ {
+ [_contentController viewDidAppear:YES];
+ }
}];
}
@@ -176,6 +180,10 @@ - (void) detachOverlay
///////////////////////////////////////////////
- (void)maskFadeOutComplete:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{
+ if ([[UIDevice currentDevice].systemVersion floatValue] < 5.0)
+ {
+ [_contentController viewDidDisappear:YES];
+ }
[self detachOverlay];
}
@@ -223,6 +231,11 @@ - (void) presentOverlayOnView:(UIView*) parentView withContent:(UIXOverlayConten
_contentController.view.frame = placement;
[maskView addSubview:_contentController.view];
+
+ if ([[UIDevice currentDevice].systemVersion floatValue] < 5.0)
+ {
+ [contentController viewDidAppear:NO];
+ }
}
}
@@ -260,6 +273,10 @@ - (void) dismissOverlay:(BOOL) animated;
}
else
{
+ if ([[UIDevice currentDevice].systemVersion floatValue] < 5.0)
+ {
+ [_contentController viewDidDisappear:NO];
+ }
[self detachOverlay];
}
}
@@ -57,6 +57,16 @@ - (void)viewDidUnload
// e.g. self.myOutlet = nil;
}
+- (void) viewDidAppear:(BOOL)animated
+{
+ NSLog(@"appear");
+}
+
+- (void) viewDidDisappear:(BOOL)animated
+{
+ NSLog(@"disappear");
+}
+
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
@@ -66,12 +76,12 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
- (IBAction) yesPressed:(id) sender
{
- [self.overlayController dismissOverlay:YES];
+ [self.overlayController dismissOverlay:DIALOG_ANIMATED];
}
- (IBAction) noPressed:(id) sender
{
- [self.overlayController dismissOverlay:YES];
+ [self.overlayController dismissOverlay:DIALOG_ANIMATED];
}
@end
@@ -11,4 +11,7 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
+
+#define DIALOG_ANIMATED NO
+
#endif
@@ -54,7 +54,7 @@ - (IBAction) showDialog:(id) sender
DialogContentViewController* vc = [[DialogContentViewController alloc] init];
- [overlay presentOverlayOnView:self.view withContent:vc animated:YES];
+ [overlay presentOverlayOnView:self.view withContent:vc animated:DIALOG_ANIMATED];
}
- (void) overlayRemoved:(UIXOverlayController*) overlayController

0 comments on commit bd8d7d9

Please sign in to comment.