All,
How would I force reload a table view (within a view controller) every five seconds for fifteen seconds when a button is pressed?
Thanks, James
First you create a timer when you press your button,
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(updateMethod) userInfo:nil repeats:YES];
Then in your method that fires every 5 seconds
- (void) updateMethod
{
[self.tableView reloadData];
}
Check out NSTimers & Apple Documentation. This will give you a concept about intervals and help you with the delay you are looking for.
And for reloading tableview, [self.tableView reloadData]; should to the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With