ラベルは UIView のサブクラスです。変更が発生したときに通知するメソッドがあると仮定します...
- (void)someMethodThatNotifiesOfChange {
// Calculate new values and assume the result means color button green
[UIView animateWithDuration:0.5 animations:^{
label.backgroundColor = [UIColor greenColor];
} completion:^(BOOL finished) {
if (finished) {
[UIView animateWithDuration:0.5 delay:5.0 options:nil animations:^{
label.backgroundColor = [UIColor clearColor];
} completion:nil];
}];
}
これは背景を緑色に変更するだけですが、それでも要点を示しています。これが緑色に変化するのに 0.5 秒かかります。次に、完了すると 5 秒間待機し、0.5 秒かけてアニメートしてクリアに戻ります。