seb*_*seb 1 ios ios6 uirefreshcontrol
我第一次使用UIRefreshControl,在加载刷新控件时出现异常.
这里是我的报关表 :
self.refreshControl = [[UIRefreshControl alloc] init];
self.refreshControl.tintColor = [UIColor grayColor];
[self.refreshControl addTarget:self action:@selector(refreshView:) forControlEvents:UIControlEventValueChanged];
[self.actualitesTableView addSubview:self.refreshControl];
Run Code Online (Sandbox Code Playgroud)
这是我的功能:
- (void)refreshView:(UIRefreshControl *)sender {
[self performSelectorInBackground:@selector(threadAction) withObject:nil];
}
- (void)threadAction {
[self choixMAJ];
NSLog(@"OK1");
[self.refreshControl endRefreshing];
NSLog(@"OK2");
}
Run Code Online (Sandbox Code Playgroud)
当我使用choixMAJ()方法时,它完美地工作.
一切正常,OK2被记录但在此之后,当刷新控件消失时,应用程序崩溃了这个错误:
*** -[__NSArrayM removeObject:]: message sent to deallocated instance 0x655a1a0
Run Code Online (Sandbox Code Playgroud)
我不明白为什么..有什么想法吗?
好吧,对于初学者,你不应该在后台线程上调用-endRefreshing.UIKit方法(包括那个)应该在主线程上执行.不过,我不确定这实际上会导致你的问题.
谢谢shusta,它帮助了我很多!
| 归档时间: |
|
| 查看次数: |
1198 次 |
| 最近记录: |