objective-c – 我想在iPad上刷新UIImageview,该怎么做?
发布时间:2020-12-16 05:50:04 所属栏目:百科 来源:网络整理
导读:我想让UI ImageView闪光几次. 目前我不知道该怎么做 实际代码: -(void)arrowsAnimate{ [UIView animateWithDuration:1.0 animations:^{ arrow1.alpha = 1.0; arrow2.alpha = 1.0; arrow3.alpha = 1.0; NSLog(@"alpha 1"); } completion:^(BOOL finished){ [
我想让UI
ImageView闪光几次.
目前我不知道该怎么做 实际代码: -(void)arrowsAnimate{ [UIView animateWithDuration:1.0 animations:^{ arrow1.alpha = 1.0; arrow2.alpha = 1.0; arrow3.alpha = 1.0; NSLog(@"alpha 1"); } completion:^(BOOL finished){ [self arrowsAnimate2]; }]; } -(void)arrowsAnimate2{ [UIView animateWithDuration:1.0 animations:^{ arrow1.alpha = 0.0; arrow2.alpha = 0.0; arrow3.alpha = 0.0; NSLog(@"alpha 0"); } completion:^(BOOL finished){;}]; } 后来我就这样称呼: for (int i = 0;i < 10; i++){ [self arrowsAnimate]; } 这给我10x alpha 1,然后是10x alpha 0.在中间我们只看到一个动画. 谢谢. 解决方法
有一个更简单的方法来实现一个闪烁的动画只使用1个动画块:
aview.alpha = 1.0f; [UIView animateWithDuration:0.5f delay:0.0f options:UIViewAnimationOptionAutoreverse animations:^ { [UIView setAnimationRepeatCount:10.0f/2.0f]; aview.alpha = 0.0f; } completion:^(BOOL finished) { [aview removeFromSuperview]; }]; 诀窍是使用[UIView setAnimationRepeatCount:NTIMES / 2]; * _inside_ *你的动画块.不需要额外的功能或额外的循环. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |