我想在用 for 反向改变 alpha 参数时产生类似于 dissolvense 的效果,但是图像在 0 和 1 之间没有改变,只有当 alpha 变为 1 时才会改变。 PD。在我的代码中,图像是 setAlpha = 0 这是该方法的代码:
-(void)splash:(UIImageView *)img{
for (double i=0.0; i<=1.0; i=i+0.1) {
for (int x=0;x<=10000;x++){
for (int h=0;h<=10000;h++){
}
}
NSLog(@"%g",i);
[img setAlpha:i];
[img reloadInputViews];
}
}
最佳答案
为什么不使用基本 View 动画在 ImageView 中淡入淡出:
- (void)splash:(UIImageView *)img {
img.alpha = 0.0;
[UIView animateWithDuration:1.0 animations:^{
img.alpha = 1.0;
}];
}
将持续时间设置为您想要的任何所需结果(以秒为单位)。
关于ios - 我怎样才能重新加载一个 imageView 与常量 chaged setAlpha?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16862606/