Skip to content

Commit

Permalink
Added property delay to SplashScreen, if one actually want to show th…
Browse files Browse the repository at this point in the history
…e SplashScreen for a longer time (don't do this :) )
  • Loading branch information
myell0w committed Jun 3, 2011
1 parent e5b54e7 commit fd45bb2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 3 additions & 0 deletions MTSplashScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
9 changes: 4 additions & 5 deletions MTSplashScreen.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ @implementation MTSplashScreen
@synthesize splashImage = splashImage_;
@synthesize showsStatusBarOnDismissal = showsStatusBarOnDismissal_;
@synthesize delegate = delegate_;
@synthesize delay = delay_;

////////////////////////////////////////////////////////////////////////
#pragma mark -
Expand All @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit fd45bb2

Please sign in to comment.