ios 启动动画的设置(闪屏)
2013-04-02 17:44
218 查看
Apple建议把启动图像做得和应用首页一样,看上去就像只是没有加载内容,譬如Settings和通讯录。这可以让用户以为已经看到了应用的界面,有信心很快就能看到内容,使用户产生应用已经迅速启动的错觉。也有很多应用使用精心制作的启动画面。这样做的问题是启动图像越是吸引注意,就越是让用户感觉启动缓慢用户甚至会以为你在故意拖延启动时间,只是为了展示自己的logo。所以并不推荐在启动动画多很多文章,这样给用户的体验会更好。详细可看《详解启动动画的商业需求和用户体验》http://oiamfish.diandian.com/post/2011-05-23/971773
在程序的入口类方法添加如下代码和方法:(加粗部分)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[window addSubview:viewController.view];
[self.window makeKeyAndVisible];
splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)];
splashView.image = [UIImage imageNamed:@"Default.png"];
[self.window addSubview:splashView];
[self.window bringSubviewToFront:splashView];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView: self.window cache:YES];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)];
splashView.alpha = 0.0;
splashView.frame = CGRectMake(-60, -85, 440, 635);
[UIView commitAnimations];
return YES;
}
- (void)startupAnimationDone:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{
[splashView removeFromSuperview];
[splashView release];
}
换一种方法同样可以实现启动动画
self.connectionTimer=[NSTimer scheduledTimerWithTimeInterval:1.5 target:self selector:@selector(timerFired:) userInfo:nil repeats:NO];
[[NSRunLoop currentRunLoop] addTimer:self.connectionTimer forMode:NSDefaultRunLoopMode];
do{
[[NSRunLoop currentRunLoop]runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]];
}while (!done);
-(void)timerFired:(NSTimer *)timer{
done = YES;
}
在程序的入口类方法添加如下代码和方法:(加粗部分)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[window addSubview:viewController.view];
[self.window makeKeyAndVisible];
splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)];
splashView.image = [UIImage imageNamed:@"Default.png"];
[self.window addSubview:splashView];
[self.window bringSubviewToFront:splashView];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView: self.window cache:YES];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)];
splashView.alpha = 0.0;
splashView.frame = CGRectMake(-60, -85, 440, 635);
[UIView commitAnimations];
return YES;
}
- (void)startupAnimationDone:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{
[splashView removeFromSuperview];
[splashView release];
}
换一种方法同样可以实现启动动画
self.connectionTimer=[NSTimer scheduledTimerWithTimeInterval:1.5 target:self selector:@selector(timerFired:) userInfo:nil repeats:NO];
[[NSRunLoop currentRunLoop] addTimer:self.connectionTimer forMode:NSDefaultRunLoopMode];
do{
[[NSRunLoop currentRunLoop]runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]];
}while (!done);
-(void)timerFired:(NSTimer *)timer{
done = YES;
}
相关文章推荐
- IOS 003 启动画面设置,以及增加启动画面动画
- IOS启动动画设置LaunchImage
- iOS LaunchScreen启动图设置
- 本地推送。启动画面的设置(iOS)
- IOS 启动画面设置
- iOS App图标和启动画面(闪屏)尺寸
- ios启动动画
- 【iOS-Cocos2d游戏开发之二十一 】自定义精灵类并为你的精灵设置攻击帧以及动画创建!【一】
- 怎样做一个iOS App的启动分层引导动画?
- iOS开发UI篇—iOS开发中三种简单的动画设置
- iOS APP设置启动图片LaunchImages
- iOS设置Launch Image 启动图片
- IOS学习之——设置APP的启动应用图片 Brand Assets
- iOS app启动图片及icon图片及应用名设置
- IOS启动动画
- ios 设置启动界面全屏
- iOS启动页的设置
- iOS 启动画面延迟设置
- IOS 开发didFinishLaunchingWithOptions 设置启动View
- 解决Activity启动黑屏及设置android:windowIsTranslucent不兼容activity切换动画问题