iOS App启动动画
2014-08-20 15:31
302 查看
开发环境 iOS7 && Xcode 5:
LaunchImageTransition是负责绘制动画的uiviewcontroler
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions
{
// Override point for customization after application launch.
UIViewController* oldRootController =self.window.rootViewController;
LaunchImageTransition* launchViewController = [[LaunchImageTransitionalloc]
initWithViewController:oldRootController
animation:UIModalTransitionStyleCrossDissolve
delay:3.0f];
launchViewController.view.backgroundColor = [UIColorredColor];
self.window.rootViewController = launchViewController;
return
YES;
}
LaunchImageTransition.m 文件内容
@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]]];
}
else if (launchImageFileiPhone !=
nil) {
[self.view
addSubview:[[UIImageView
alloc] initWithImage:[UIImage
imageNamed:launchImageFileiPhone]]];
}
else {
[self.view
addSubview:[[UIImageView
alloc] initWithImage:[UIImage
imageNamed:@"Default.png"]]];
}
[controller
setModalTransitionStyle:transition];
[NSTimer
scheduledTimerWithTimeInterval:seconds
target:self
selector:@selector(timerFireMethod:)
userInfo:controller repeats:NO];
}
return
self;
}
- (void)timerFireMethod:(NSTimer *)theTimer {
[self
presentViewController:[theTimer userInfo]
animated:YES
completion:^(){
}];
}
@end
LaunchImageTransition是负责绘制动画的uiviewcontroler
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions
{
// Override point for customization after application launch.
UIViewController* oldRootController =self.window.rootViewController;
LaunchImageTransition* launchViewController = [[LaunchImageTransitionalloc]
initWithViewController:oldRootController
animation:UIModalTransitionStyleCrossDissolve
delay:3.0f];
launchViewController.view.backgroundColor = [UIColorredColor];
self.window.rootViewController = launchViewController;
return
YES;
}
LaunchImageTransition.m 文件内容
@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]]];
}
else if (launchImageFileiPhone !=
nil) {
[self.view
addSubview:[[UIImageView
alloc] initWithImage:[UIImage
imageNamed:launchImageFileiPhone]]];
}
else {
[self.view
addSubview:[[UIImageView
alloc] initWithImage:[UIImage
imageNamed:@"Default.png"]]];
}
[controller
setModalTransitionStyle:transition];
[NSTimer
scheduledTimerWithTimeInterval:seconds
target:self
selector:@selector(timerFireMethod:)
userInfo:controller repeats:NO];
}
return
self;
}
- (void)timerFireMethod:(NSTimer *)theTimer {
[self
presentViewController:[theTimer userInfo]
animated:YES
completion:^(){
}];
}
@end
相关文章推荐
- IOS app启动动画的实现
- iOS——app启动动画
- 怎样做一个iOS App的启动分层引导动画?
- 怎样做一个iOS App的启动分层引导动画?
- iOSAPP启动效果复杂动画之抽丝剥茧
- 内存图片IOS app启动动画的实现
- 怎样做一个iOS App的启动分层引导动画?
- iOSAPP启动效果复杂动画之抽丝剥茧
- 为iOS App增加启动动画效果
- 怎样做一个iOS App的启动分层引导动画?
- IOS app启动动画的实现
- IOS app启动动画的实现
- 怎样做一个iOS App的启动分层引导动画
- iOS App的图标,启动画面及其它
- 为iOS App增加启动渐变效果
- iOS App的图标,启动画面及其它
- ios app 启动过程
- iOS 新手指引在App中的添加,第一次启动应用程序出现,后面都不出现
- iOS App的图标,启动画面及其它