關於ios動畫,自己在以往的開發中用到的很少,這次遇到這麼個需求:在乙個操作完成前我需要加上動畫效果,其實只是兩張不斷替換。當然用uiimageview載入。在請教別人之後,知道了uiimageview使用動畫的方法,我又把它跟mbprogresshud相結合使用,**如下:
//新增開門動畫
mbprogresshud *
animationhud
= [[
mbprogresshud
alloc
] initwithview
:self
.view];
[animationhud
setremovefromsuperviewonhide
:yes];
uiview
*view =[[
uiview
alloc
]initwithframe
:cgrectmake(0
,0, 57
, 81
)];
uiimageview
*imageview=[[
uiimageview
alloc
]initwithimage
:[uiimage
imagenamed
:@"icon_open.png"
]];
imageview.
animationimages
= [nsarray
arraywithobjects
: [uiimage
imagenamed
:@"icon_open_nocharacter"
],[uiimage
imagenamed
:@"icon_close_nocharacter"
],nil];
imageview.
animationduration
= 0.5f;
imageview.
animationrepeatcount= 0
; //0代表無限大
imageview.
userinteractionenabled
= yes;
[imageview
startanimating];
imageview.
frame
=view.
frame;
[view
addsubview
:imageview]; [
animationhud
setcustomview
:view]; [
animationhud
setmode
:mbprogresshudmodecustomview];
[self
.view
addsubview
:animationhud];
[animationhud
show
:yes];
IOS中UIImageView方法實現簡單動畫
ios中uiimageview方法實現簡單動畫 查閱uiimageview文件時,發現uiimageview有一組關於動畫的方法 引數,可以實現簡單的動畫。包括 animation程式設計客棧images highlightedanimati程式設計客棧onimages animationdurat...
UIImageView動畫顯示
nsautoreleasepool pool nsautoreleasepool alloc init nsarray myimages nsarray arraywithobjects uiimage imagenamed myimage1.png uiimage imagenamed myima...
UIImageview 點選事件
uiimageview imageview uiimageview alloc initwithframe cgrectmake 100,100,200,200 imageview.image uiimage imagenamed filter laozhaopian a.png imageview...