Question

I'm working with Parse.com through the use of a TableView and not a PFQueryTableView.

The query fetches the data from class Class "Friends" for the key "STATUS" On TableviewCell I have a button that changes the status from "Pending" to "Confirmed".

The Tableview works perfectly and also his actions on the button, I only have one problem, the Tableview immediately updating the modified data .. If the state of the cell is changed from "Pending" to "Confirmed" should disappear because this cell is no longer 'part of the query for all objects "Pending" ..

I also tried [self.tableview reloadData] but nothing changes ... There 'some way to get a refresh of the data in the table immediately?

- (IBAction)AcceptFriendRequest:(id)sender {


    PFObject *SelectedUser = [self.UtentiInAttesa objectAtIndex:[sender tag]];
    [SelectedUser setObject:@"Confirmed" forKey:@"STATUS"];
    [SelectedUser saveInBackground];

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDelay:0.5];
    [UIView setAnimationBeginsFromCurrentState:YES];
    FFScrollView.frame = CGRectMake(FFScrollView.frame.origin.x, (FFScrollView.frame.origin.y -80.0), FFScrollView.frame.size.width, FFScrollView.frame.size.height);
    [UIView commitAnimations];

}
Was it helpful?

Solution

use [yourtimer invalidate] in your code block where you're sure you get result updated. or simply change your

[NSTimer scheduledTimerWithTimeInterval: 1 target: self selector: @ selector (RefreshFFTableView) userInfo: nil repeats: YES] 

to

[[NSTimer scheduledTimerWithTimeInterval: 1 target: self selector: @ selector (RefreshFFTableView) userInfo: nil repeats: NO] 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top