ios - UIImageView+animatedGIF always LOOPS -


i used class made "mayoff" (rob mayoff) "uiimageview+animatedgif" proposed in 1 of answers here on stackoverflow. uiimageview+animatedgif

with can import animated .gif images in uiimageview on ios. class works flawlessly, problem .gif looping. no matter how export (i exporting image photoshop - 67 frames, set repeat "once") loops forever in uiimageview.

i importing .gif these 2 lines:

nsurl *url = [[nsbundle mainbundle] urlforresource:@"loading" withextension:@"gif"]; self.loadingimageview.image = [uiimage animatedimagewithanimatedgifdata:[nsdata datawithcontentsofurl:url]]; 

very simple , works. have tried setting animationrepeatcount property 1, recomended rob didn't trick. have tried setting uiimageview's animationimages property gifimage.images too, instead of setting view's image property gifimage. in case, .gif not animating @ all.

any ideas how play .gif once? can think of many tricks (like setting last frame of gif show after time i'd first try simpler if possible).

i took test app project , changed viewdidload method this:

- (void)viewdidload {     [super viewdidload];      nsurl *url = [[nsbundle mainbundle] urlforresource:@"test" withextension:@"gif"];     uiimage *testimage = [uiimage animatedimagewithanimatedgifdata:[nsdata datawithcontentsofurl:url]];     self.dataimageview.animationimages = testimage.images;     self.dataimageview.animationduration = testimage.duration;     self.dataimageview.animationrepeatcount = 1;     self.dataimageview.image = testimage.images.lastobject;     [self.dataimageview startanimating]; } 

when app launches, animates image once , shows last frame. if connect button sends [self.dataimageview startanimating], tapping button runs animation 1 more time, stops again on last frame.

make sure you're setting image view way above. make sure not setting image view's image property animated image. image view's image property must set non-animated image if want animation stop.


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -