4
我開始嘗試重新從應用程序商店購買按鈕,需要2階段點擊購買的東西。我爲擴展按鈕設置動畫。到目前爲止,我有這個UIView動畫更改大小的按鈕
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.75];
sender.autoresizesSubviews = NO;
sender.clipsToBounds = NO;
sender.frame = CGRectMake(63,326,200,37);
[UIView commitAnimations];
這只是導致按鈕變得更大,它不動畫在所有。我做錯了什麼或有其他人實現了這種類型的按鈕行爲?
編輯:
- (IBAction) buyButtonAction: (UIButton *) sender {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationDelay:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
sender.clipsToBounds = NO;
sender.frame = CGRectMake(CGRectGetMinX(sender.frame) - 30, CGRectGetMinY(sender.frame), 200, 37);
[sender setTitle:@"Touched Touched Touched" forState:UIControlStateNormal];
[UIView commitAnimations];
}
我想我一定在做錯事。我使用了您提供的更長的片段,現在尺寸立即發生變化,然後唯一動畫就是移動按鈕的位置?!?!我已經對原始帖子進行了編輯,向您展示了代碼的位置。 – Josh
我把你的屬性更改放到我的示例代碼中,取出setTitle,因爲我不認爲這部分動畫適當。我放置了一個位置 - 30爲我的代碼的按鈕的X座標。我會編輯我的代碼來使用你的動畫,也許這將提供有用的結果。 – LrdCasimir
太棒了,謝謝。不知道什麼是最初的錯誤,但現在得到它排序謝謝。 – Josh