我創建一個UIButton有stretchableImageWithLeftCapWidth:topCapHeight:Cocoa Touch中可拉伸按鈕圖像的大小是否可以動畫?
我想改變它的大小與流暢的Core Animation,像這樣:
float shrinkFactor = 0.2;
NSTimeInterval slowSpeed = 5.0;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:slowSpeed];
UIButton *thisButton = (UIButton *)[self.view viewWithTag:2];
thisButton.frame = CGRectMake(thisButton.frame.origin.x, thisButton.frame.origin.y, buttonStretchedWidth * shrinkFactor, thisButton.frame.size.height);
[UIView commitAnimations];
按鈕圖像尺寸不動畫,它只是捕捉到新的尺寸。
當我使backgroundColor的按鈕可見時,我看到框架本身的動畫正確。
我錯過了什麼東西,或者圖像拉伸不動畫?