开发者

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

开发者 https://www.devze.com 2023-02-12 17:40 出处:网络
I call method sr in viewDidLoad with below code,how can i cancel it before that method sr will call? [self performSelector:@selector(sr) withObjec开发者_开发知识库t:nil afterDelay:20];

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

[self performSelector:@selector(sr) withObjec开发者_开发知识库t:nil afterDelay:20]; 


[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

精彩评论

暂无评论...
验证码 换一张
取 消