目前,我有一个应用程序正在使用UIRefreshControl
.
虽然我有一些问题......
这是我的代码:
- (void)viewDidLoad
{
[super viewDidLoad];
self.searchDisplayController.delegate = self;
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
[self.rearTableView addSubview:refreshControl];
}
- (void)refresh:(UIRefreshControl *)refreshControl {
[refreshControl beginRefreshing];
[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(endRefresh:) userInfo:nil repeats:NO];
}
- (void)endRefresh:(UIRefreshControl *)refresh
{
[refresh endRefreshing];
}
拉动 tableview 确实会初始化,timer
但2
秒到了......我的应用程序crashes
并发送此消息:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFTimer endRefreshing]: unrecognized selector sent to instance 0x9c093c0'
我很困惑 :(