Permalink
Browse files

Added property delay to SplashScreen, if one actually want to show th…

…e SplashScreen for a longer time (don't do this :) )
  • Loading branch information...
1 parent e5b54e7 commit fd45bb2191d761224223a7fbb0d84fd40a814a38 @myell0w myell0w committed Jun 3, 2011
Showing with 7 additions and 5 deletions.
  1. +3 −0 MTSplashScreen.h
  2. +4 −5 MTSplashScreen.m
View
3 MTSplashScreen.h
@@ -17,13 +17,16 @@
@interface MTSplashScreen : UIViewController {
UIImage *splashImage_;
BOOL showsStatusBarOnDismissal_;
+ NSTimeInterval delay_;
id<MTSplashScreenDelegate> delegate_;
}
@property (nonatomic, retain) UIImage *splashImage;
@property (nonatomic, assign) BOOL showsStatusBarOnDismissal;
@property (nonatomic, assign) id<MTSplashScreenDelegate> delegate;
+@property (nonatomic, assign) NSTimeInterval delay;
+
+ (MTSplashScreen *)splashScreen;
View
9 MTSplashScreen.m
@@ -19,6 +19,7 @@ @implementation MTSplashScreen
@synthesize splashImage = splashImage_;
@synthesize showsStatusBarOnDismissal = showsStatusBarOnDismissal_;
@synthesize delegate = delegate_;
+@synthesize delay = delay_;
////////////////////////////////////////////////////////////////////////
#pragma mark -
@@ -33,10 +34,8 @@ + (MTSplashScreen *)splashScreen {
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
- if (isIPad()) {
- showsStatusBarOnDismissal_ = YES;
- self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
- }
+ self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
+ delay_ = 0.;
}
return self;
@@ -74,7 +73,7 @@ - (void)viewDidAppear:(BOOL)animated {
[self.delegate splashScreenDidAppear:self];
}
- [self hide];
+ [self performSelector:@selector(hide) withObject:nil afterDelay:self.delay];
}
- (void)viewWillDisappear:(BOOL)animated {

0 comments on commit fd45bb2

Please sign in to comment.