In my application I have a table view in second view controller. After some time I display an alert view using timer on which I have two buttons yes and no. When I click yes the alert view gets dismissed and when I click the no it should delete all items in table view and reload it.
Problem
I am not able to refresh the table view when I go to first view controller and return to second view controller.If I am in same view controller, it reloads perfectly.
Timer function
start_Timer = [NSTimer scheduledTimerWithTimeInterval:30 target:self selector:@selector(start_method) userInfo:nil repeats:NO];
Alert show
-(void)start_method
{
Timerfunction_alert = [[UIAlertView alloc] initWithTitle:@"" message:@"You have less than one minute before all items on your order list are released as it is about to exceed the 15-minutes hold time allocated to you to complete your order. Do you wish to continue ordering this item?"
delegate:self
cancelButtonTitle:@"NO"
otherButtonTitles:@"YES", nil];
[Timerfunction_alert show];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (alertView == Timerfunction_alert)
{
if (buttonIndex == 0)
{
//here to refresh the table view
[self.tableview reloaddata]
}
}
}