IOS启动页动画(uiview 淡入淡出效果 )2
2018-03-01 15:40
357 查看
Appdelegate里面右个这个函数,只要它没结束,你的等待界面就不会消失。
以在启动的时候做些动画
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[window addSubview:viewController.view];
[self.window makeKeyAndVisible];
//装载启动页的视图
imgview=[[UIImageView alloc]initWithFrame:self.window.frame];
imgview.image=[UIImage imageNamed:@"Default"];
imgview.alpha = 0.0;
[bgView addSubview:imgview];
//动画--淡入
[UIView beginAnimations:nil context:nil];//标记动画块开始
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];//定义动画加速和减速方式
[UIView setAnimationDuration:0.5];//动画时长
[UIView setAnimationDelegate:self];
imgview.alpha = 1.0;
//动画结束后回调方法
[UIView setAnimationDidStopSelector:@selector(showArrowDidStop:finished:context:)];
[UIView commitAnimations];//标志动滑块结束
return YES;
}
//动画--淡出
-(void)hiddenAnimation
{
[UIView animateWithDuration:0.5 animations:^{
imgview.alpha=0.0;
} completion:^(BOOL finished) {
[imgview removeFromSuperview];
[bgView removeFromSuperview];
}];
// [UIView beginAnimations:@"HideArrow" context:nil];
// [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
// [UIView setAnimationDuration:0.5];
// [UIView setAnimationDelay:1.0];
// imgview.alpha = 0.0;
// [UIView commitAnimations];
}
- (void)showArrowDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{
[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(hiddenAnimation) userInfo:Nil repeats:NO];
}
以在启动的时候做些动画
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[window addSubview:viewController.view];
[self.window makeKeyAndVisible];
//装载启动页的视图
imgview=[[UIImageView alloc]initWithFrame:self.window.frame];
imgview.image=[UIImage imageNamed:@"Default"];
imgview.alpha = 0.0;
[bgView addSubview:imgview];
//动画--淡入
[UIView beginAnimations:nil context:nil];//标记动画块开始
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];//定义动画加速和减速方式
[UIView setAnimationDuration:0.5];//动画时长
[UIView setAnimationDelegate:self];
imgview.alpha = 1.0;
//动画结束后回调方法
[UIView setAnimationDidStopSelector:@selector(showArrowDidStop:finished:context:)];
[UIView commitAnimations];//标志动滑块结束
return YES;
}
//动画--淡出
-(void)hiddenAnimation
{
[UIView animateWithDuration:0.5 animations:^{
imgview.alpha=0.0;
} completion:^(BOOL finished) {
[imgview removeFromSuperview];
[bgView removeFromSuperview];
}];
// [UIView beginAnimations:@"HideArrow" context:nil];
// [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
// [UIView setAnimationDuration:0.5];
// [UIView setAnimationDelay:1.0];
// imgview.alpha = 0.0;
// [UIView commitAnimations];
}
- (void)showArrowDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{
[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(hiddenAnimation) userInfo:Nil repeats:NO];
}
相关文章推荐
- 【IOS动画】UIView放大缩小背景淡入淡出动画效果
- IOS开发-UIView之动画效果的实现方法(合集)
- ios UIView常用动画效果
- IOS开发-UIView之动画效果的实现方法(合集)
- IOS开发-UIView之动画效果的实现方法(一)
- iOS开发-UIView之动画效果的实现方法
- IOS开发-UIView之动画效果的实现方法(合集)
- 为iOS App增加启动动画效果
- IOS开发-UIView之动画效果的实现方法(合集)
- IOS开发-UIView之动画效果的实现方法
- ios开发之UIView动画效果实现二
- IOS实现视频动画效果的启动图
- IOS开发之UIView动画效果的实现
- iOS开发-UIView之动画效果的实现方法(合集)
- IOS开发-UIView之动画效果的实现方法(合集)
- 源码推荐(8.17):闪屏效果,简易动画引擎,iOS UIView自定义四个边角的圆角
- (0034) iOS 开发之UIView动画(过渡效果)
- IOS开发-UIView之动画效果的实现方法
- IOS开发之UIView动画效果的实现
- iOS常用的一些动画效果,UIView封装的动画,CALayer的动画等