Cancel [self performSelector:… withObject:nil afterDelay:20];

后端 未结 1 1133
鱼传尺愫
鱼传尺愫 2021-01-31 03:16

I call method sr in viewDidLoad with below code,how can i cancel it before that method sr will call?

[self performSelector:@selector(sr) withObject:nil afterDela         


        
相关标签:
1条回答
  • 2021-01-31 03:40
    [NSObject cancelPreviousPerformRequestsWithTarget:self
                                             selector:@selector(sr)
                                               object:nil];
    

    Please read the documentation. :) The documentation for -performSelector:withObject:afterDelay: points you to the methods for canceling a queued perform request.

    0 讨论(0)
提交回复
热议问题