3 回答

TA貢獻1815條經驗 獲得超6個贊
我這樣做的方法是為你的終點創(chuàng)建一個新的動畫。設置一個非常短的持續(xù)時間,并確保使用該+setAnimationBeginsFromCurrentState:方法從當前狀態(tài)開始。將其設置為YES時,將縮短當前動畫??雌饋硐襁@樣:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.1];
[UIView setAnimationCurve: UIViewAnimationCurveLinear];
// other animation properties
// set view properties
[UIView commitAnimations];

TA貢獻1982條經驗 獲得超2個贊
使用:
#import <QuartzCore/QuartzCore.h>
.......
[myView.layer removeAllAnimations];

TA貢獻1909條經驗 獲得超7個贊
停止最簡單的方法都在特定視圖動畫,立刻,是這樣的:
將項目鏈接到QuartzCore.framework。在代碼的開頭:
#import <QuartzCore/QuartzCore.h>
現(xiàn)在,當你想停止視頻中的所有動畫時,請說:
[CATransaction begin];
[theView.layer removeAllAnimations];
[CATransaction commit];
中間線本身可以工作,但是在runloop完成之前有一段延遲(“重繪時刻”)。要防止該延遲,請將命令包裝在顯式事務塊中,如圖所示。這項工作在當前的runloop中沒有對該層執(zhí)行任何其他更改。
- 3 回答
- 0 關注
- 1538 瀏覽
添加回答
舉報