PerformSelector:withObject:afterDelay: 如何工作?
我发现在调用 [self PerformSelector:@selector(method1:) withObject:self.tableView afterDelay:3];
之后 self.tableView
的 retainCount改变?为什么?
非常感谢!
I have found that after calling [self performSelector:@selector(method1:) withObject:self.tableView afterDelay:3];
that self.tableView
's retainCount
changes? Why?
Thank you very much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信表视图的保留可能会增加,因为调用performSelector: withObject: afterDelay: 会保留参数,以便在方法最终执行时它不会消失。文档此处 。
I believe the retain could of your table view would be incremented because calling
performSelector: withObject: afterDelay:
retains the parameter so that it isn't gone when the method finally is executed. Documentation here.您不必担心它 - tableView 将在选择器等待执行时保留,然后在执行后自动再次释放。这不会导致泄漏或崩溃。
You shouldn't have to worry about it - tableView will be retained while the selector is waiting to be executed and then automatically released again after it has executed. This won't cause leaks or crashes.