Currently, I have an application that is using UIRefreshControl
.
I am having some issues though...
Heres my code:
- (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];
}
Pulling the tableview does initialize the timer
but the 2
seconds are up... my app crashes
and sends this message:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFTimer endRefreshing]: unrecognized selector sent to instance 0x9c093c0'
I am confused :(