Access Method After UIImageView Animation Finish

后端 未结 7 943
清酒与你
清酒与你 2020-12-01 11:47

I have an array of images loaded into a UIImageView that I am animating through one cycle. After the images have been displayed, I would like a @selector to be

7条回答
  •  不知归路
    2020-12-01 12:09

    Use performSelector:withObject:afterDelay::

    [self performSelector:@selector(animationDidFinish:) withObject:nil
        afterDelay:instructions.animationDuration];
    

    or use dispatch_after:

    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, instructions.animationDuration * NSEC_PER_SEC);
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
        [self animationDidFinish];
    });
    

提交回复
热议问题