ios - UIView transitionWithView not working first time only -
i'm making slideshow using uiimageview , nstimer. working fine except first time when transitionwithview method called, animation doesn't happen, changes image without cross-dissolve, , after that, cross dissolve works @ every image change.
please can find error in code:
-(void) startslideshow { nsurl *imageurl = [nsurl urlwithstring:[self.arrimagelinks objectatindex:currentimage]]; [uiview transitionwithview:self.imageview duration:1.0f options:uiviewanimationoptiontransitioncrossdissolve animations:^{ [manager downloadimagewithurl:imageurl options:0 progress:^(nsinteger receivedsize, nsinteger expectedsize) { } completed:^(uiimage *image, nserror *error, sdimagecachetype cachetype, bool finished, nsurl *imageurl) { if (image) { [self.imageview setimage:image]; } }]; } completion:nil]; timer = [nstimer timerwithtimeinterval:6.0 target:self selector:@selector(handletimer:) userinfo:nil repeats:yes]; [[nsrunloop mainrunloop] addtimer:timer formode:nsdefaultrunloopmode]; } here's handletimer code :
- (void) handletimer: (nstimer *) timer { currentimage++; if ( currentimage >= self.arrimagelinks.count ) currentimage = 0; nsurl *imageurl = [nsurl urlwithstring:[self.arrimagelinks objectatindex:currentimage]]; [uiview transitionwithview:self.imageview duration:1.0f options:uiviewanimationoptiontransitioncrossdissolve animations:^{ [manager downloadimagewithurl:imageurl options:0 progress:^(nsinteger receivedsize, nsinteger expectedsize) { } completed:^(uiimage *image, nserror *error, sdimagecachetype cachetype, bool finished, nsurl *imageurl) { if (image) { [self.imageview setimage:image]; } }]; } completion:nil]; }
Comments
Post a Comment