UIView過渡動畫整理

2021-06-06 02:49:48 字數 1427 閱讀 1136

使用uiview類的uiviewanimation擴充套件

uiview動畫是成塊執行的。發出beginanimations:context:請求標誌著動畫塊的開始;commitanimations標誌著動畫塊的結束。把這兩個類方法傳送給uiview而不是傳送給單獨的檢視。在這兩個呼叫之間的可定義動畫的展現方式並更新檢視。函式說明:

//開始準備動畫

+ (void)beginanimations:(nsstring *)animationid context:(void *)context;

//執行動畫

+ (void)commitanimations;

具體二段動畫**:

[uiview beginanimations:nil context:nil];

//setanimationcurve來定義動畫加速或減速方式

[uiview setanimaitoncurve:uiviewanimationcurvelinear];

[uiview setanimationduration:2.7]; //動畫時長

[uiview setanimationtransition:transition forview:self.view cache:yes];

// operation>>>

[self.view exchangesubviewatindex:0 withsubviewatindex:1];

// end<<<<<

[uiview commitanimations];

cgcontextref context = uigraphicsgetcurrentcontext(); //返回當前檢視堆疊頂部的圖形上下文

[uiview beginanimations:nil context:context];

[uiview setanimaitoncurve:uiviewanimationcurveeaseinout];

[uiview setanimationduration:1.0];

// view changes go here

[contextview setalpha:0.0f];

[uiview commitanimations];

其中transition取值範圍:uiview類本身提供四種過渡效果

uiviewanimationtransitionnone 正常

uiviewanimationtransitionflipfromleft 從左向右翻

uiviewanimationtransitionflipfromright 從右向左翻

uiviewanimationtransitioncurlup 從下向上卷

uiviewanimationtransitioncurldown 從上向下卷 

iOS 動畫 UIView動畫

viewcontroller.m ui 23 動畫 import viewcontroller.h inte ce viewcontroller property strong,nonatomic iboutlet uiview opeview1 property strong,nonatomic ...

動畫之UIView動畫

uiview有三種型別的動畫 它是對uiview的屬性進行動畫的一種方法,能進行動畫顯示的動畫包括 位置和大小 bounds frame center 背景與透明 backgroundcolor alpha 轉換 transform 它包括一種特殊很炫的動畫形式 彈簧動畫usingspringwit...

UIView 實現動畫

動畫為使用者介面在不同狀態之間的遷移過程提供流暢的視覺效果。在iphone 類中,以簡化動畫的建立過程。也就是說,當這些屬性值發生變化時,檢視為其變化過程提供內建的動畫支援。雖然執行動畫所需要的工作由uiview類自動完成,但您仍然必須在希望執行動畫時通知檢視。為此,您需要將改變給定屬性的 包裝在乙...