應用中想要給UIButton加一個動畫。讓按鈕能淡出屏幕然後隱藏。
我寫的代碼,沒實現:
[UIView animateWithDuration:1.5
animations:^{
S1Button.frame = CGRectMake(20, 10, 50, 10);
}];
[S1Button setHidden:YES];
break;
可以在動畫結束後給按鈕設置新坐標:
[UIView animateWithDuration:0.9 animations:^{
tradeButton.frame = (CGRect){ CGPointMake(51, 150), tradeButton.bounds.size };
} completion:^(BOOL finished) {
tradeButton.hidden = YES;
// etc.
}];