-
Notifications
You must be signed in to change notification settings - Fork 19
/
LaunchImageTransition.m
44 lines (31 loc) · 1.51 KB
/
LaunchImageTransition.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// LaunchImageTransition.m
// Created by http://github.com/iosdeveloper
//
#import "LaunchImageTransition.h"
@implementation LaunchImageTransition
- (id)initWithViewController:(UIViewController *)controller animation:(UIModalTransitionStyle)transition {
return [self initWithViewController:controller animation:transition delay:0.0];
}
- (id)initWithViewController:(UIViewController *)controller animation:(UIModalTransitionStyle)transition delay:(NSTimeInterval)seconds {
self = [super init];
if (self) {
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *launchImageFile = [infoDictionary objectForKey:@"UILaunchImageFile"];
NSString *launchImageFileiPhone = [infoDictionary objectForKey:@"UILaunchImageFile~iphone"];
if (launchImageFile != nil) {
[self.view addSubview:[[[UIImageView alloc] initWithImage:[UIImage imageNamed:launchImageFile]] autorelease]];
} else if (launchImageFileiPhone != nil) {
[self.view addSubview:[[[UIImageView alloc] initWithImage:[UIImage imageNamed:launchImageFileiPhone]] autorelease]];
} else {
[self.view addSubview:[[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Default.png"]] autorelease]];
}
[controller setModalTransitionStyle:transition];
[NSTimer scheduledTimerWithTimeInterval:seconds target:self selector:@selector(timerFireMethod:) userInfo:controller repeats:NO];
}
return self;
}
- (void)timerFireMethod:(NSTimer *)theTimer {
[self presentModalViewController:[theTimer userInfo] animated:YES];
}
@end