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~
解决方案 »
- ios如何实现像微博那样的界面切换
- 图片超出UITableViewCell问题
- ios应用绑定微博账号,怎么实现?
- Objective-C新手求教关于分类的问题!~~
- ios 7 下载了一个企业级部署的应用,出现2个图标
- 好奇怪的问题! uitablecell中的uiimageview ,有的响应gesture recognizer,有的不响应
- IOS模拟器能获取运营商信息,网络连接类型以及地理位置吗?
- 新手學IOS,升級到xcode 6 后,對 IOS 的開發學習很迷惑,求指點
- iOS mysql-connect-c 往mysql中插入数据时 出现中文乱码
- IOS GL glReadPixels 崩溃问题
- 用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];
}]; });