ios - iPhone : Best way to detect the end of UIImageView image sequence animation -
we know uiimageview has nice support image sequence animation. can create array of uiimage objects, set animationimages property, configure animation duration, repeat count etc. , fire. there seems no way know when animation has ended.
say have ten images , want run animation (repeat count = 1) them. , when animation over, want run other code. best way know animation has ended?
i understand can create nstimer , schedule fire after animation duration. cannot rely on timer if need precision. 
so question is, there better way know uiimageview image sequence animation has ended without using timer?
the code
myimageview.animationimages = images; // images nsarray of uiimages myimageview.animationduration = 2.0; myimageview.animationrepeatcount = 1; [myimageview startanimating]
the isanimating property on uiimageview should go no when it's done animating. it's not formal property, though, can't set observation on it. can poll on fine-grained timer (like cadisplaylink's).
there's no "animation completed" delegate this, if that's sort of thing you're looking for. timing can variable based on loading delay of images, etc, , no, there's no sure-fire way know precisely when it's done.
the image animation stuff on uiimageview convenience, , not heavyweight enough serious animation work with. consider rolling own if need kind of precision.
Comments
Post a Comment