我有一些这样的代码:
//up till now someButton's alpha was 1
someButton.alpha = 0;
[UIView animateWithDuration:.25
delay:0.0
options:kMaskEaseOut
animations:^ {
someButton.alpha = 1;
}
completion:^ (BOOL finished){}];
问题是 someButton 的 alpha 在动画开始之前没有设置为 0,即视觉上没有任何反应。现在,如果我注释掉整个动画块,它确实会将 someButton 的 alpha 设置为 0。此外,如果我这样做:
[UIView animateWithDuration:0
delay:0.0
options:kMaskEaseOut
animations:^ {
someButton.alpha = 0;
} completion:^ (BOOL finished){
[UIView animateWithDuration:.25
delay:0.0
options:kMaskEaseOut
animations:^ {
someButton.alpha = 1;
}
completion:^ (BOOL finished){}];
}];
它工作正常(我在 0 长度动画后开始动画),这有点傻。