UIImageView *splash = [[UIImageView alloc] initWithFrame:self.window.bounds];
UIImageView *splash2 = [[UIImageView alloc] initWithFrame:self.window.bounds];
splash.image = [UIImage imageNamed:@"img1"];
splash2.image = [UIImage imageNamed:@"img2"];
[self.window addSubview:splash];
[UIView animateWithDuration:4.0 animations:^{
splash.alpha = 0.0;
} completion:^(BOOL finished){
[splash removeFromSuperview];
}];
[self.window addSubview:splash2];
[UIView animateWithDuration:4.0 animations:^{
splash2.alpha = 0.0;
} completion:^(BOOL finished){
[splash2 removeFromSuperview];
}];我想要的结果是第一个图片直接显示,然后淡出,然后淡入第二个图片,然后淡出
如上,这样是错误的,是第一个图片直接切换到第二个图片,然后交叉在一起淡出,不知道怎么改?谢谢各位dx~
UIImageView *splash2 = [[UIImageView alloc] initWithFrame:self.window.bounds];
splash.image = [UIImage imageNamed:@"img1"];
splash2.image = [UIImage imageNamed:@"img2"];
[self.window addSubview:splash];
[UIView animateWithDuration:4.0 animations:^{
splash.alpha = 0.0;
} completion:^(BOOL finished){
[splash removeFromSuperview];
}];
[self.window addSubview:splash2];
[UIView animateWithDuration:4.0 animations:^{
splash2.alpha = 0.0;
} completion:^(BOOL finished){
[splash2 removeFromSuperview];
}];我想要的结果是第一个图片直接显示,然后淡出,然后淡入第二个图片,然后淡出
如上,这样是错误的,是第一个图片直接切换到第二个图片,然后交叉在一起淡出,不知道怎么改?谢谢各位dx~
解决方案 »
- BOOL*是什么意思
- ios缩小动画的问题!
- 请问:IPAD,IPHONE开机自动启动程序A,如何实现?IPAD,IPHONE程序A(版本1.0)自动升级程序A(版本2.0)功能如何实现?
- IOS5.0 ALAssetsLibraryChangedNotification消息不执行
- [原创]兄弟我做了一个刷榜检测的工具,希望大家给提提意见
- Iphone xib文件中的含义
- UI页面效果图,请分析一下View的设计和布局控件。
- iOS新手 汤姆猫 占用内存问题
- 步伐企业版ipa,下载提示“无法下载应用程序,此时无法安装”
- ios other linker 添加-ObjC 报错
- 用UITableView在Storyboard中传递的问题
- iOS 可以实现对字符串的压缩吗
[UIView animateWithDuration:4.0 animations:^{
splash2.alpha = 0.0;
} completion:^(BOOL finished){
[splash2 removeFromSuperview];
}];修改为 8秒 不就好了吗
splash.alpha = 0.0;
} completion:^(BOOL finished){
[splash removeFromSuperview];
[self.window addSubview:splash2];
[UIView animateWithDuration:4.0 animations:^{
splash2.alpha = 0.0;
} completion:^(BOOL finished){
[splash2 removeFromSuperview];
}];
}];
UIImageView *splash2 = [[UIImageView alloc] initWithFrame:self.window.bounds];
splash.image = [UIImage imageNamed:@"img1"];
splash2.image = [UIImage imageNamed:@"img2"];
[self.window addSubview:splash];
[UIView animateWithDuration:4.0 animations:^{
splash.alpha = 0.0;
} completion:^(BOOL finished){
[splash removeFromSuperview];
//搬个家就好了
[self.window addSubview:splash2];
[UIView animateWithDuration:4.0 animations:^{
splash2.alpha = 0.0;
} completion:^(BOOL finished){
[splash2 removeFromSuperview];
}];
}];居然还有这种问题,这是不使用延迟的做法,不想这样嵌套就dispatch_after
splash.alpha = 0.0;
} completion:^(BOOL finished){
[splash removeFromSuperview];
}];
double delayInSeconds = 4.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[self.window addSubview:splash2];
[UIView animateWithDuration:4.0 animations:^{
splash2.alpha = 0.0;
} completion:^(BOOL finished){
[splash2 removeFromSuperview];
}]; });