How can I delay a method call for 1 second?

前端 未结 11 1369
别跟我提以往
别跟我提以往 2020-11-30 18:19

Is there an easy way delay a method call for 1 second?

I have a UIImageView that reacts on a touch event. When the touch is detected, some animations ha

11条回答
  •  抹茶落季
    2020-11-30 18:51

    Best way to do is :

    [self performSelector:@selector(YourFunctionName) 
               withObject:(can be Self or Object from other Classes) 
               afterDelay:(Time Of Delay)];
    

    you can also pass nil as withObject parameter.

    example :

    [self performSelector:@selector(subscribe) withObject:self afterDelay:3.0 ];
    

提交回复
热议问题