0

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];

}
5
  • Hello everyone, I managed to get my goal in entering viewDidLoad [NSTimer scheduledTimerWithTimeInterval: 1 target: self selector: @ selector (RefreshFFTableView) userInfo: nil repeats: YES]; in the selector so I inserted the query is re-created every second of the query and the page refreshes ... I only have one problem, how do I stop the timer? because when I left the view controller timer query is reflected in all the pages of the app. Each page updates its query every second instead serves me that this action is made only in one specific viewController Commented Oct 25, 2013 at 18:39
  • 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] Commented Oct 26, 2013 at 2:00
  • The latter solution might not fit your need because your object might not returned yet when timer finish. You should have your own timer object, get it started, and stop it where you make sure you get your returned object Commented Oct 26, 2013 at 2:05
  • Babygau Hello, I opted for - (void) viewDidDisappear: (BOOL) animated { if (timer) { [Timer invalidate]; Timer = nil;} } It seems to work fine! Thank you very much for your advice: D!! you know nothing about how to automatically animate a view? stackoverflow.com/questions/19600506/… Commented Oct 26, 2013 at 10:25
  • I updated the answer because it hit right to ur issue. I will have a look at your other question when I got my time :) Commented Oct 27, 2013 at 3:07

1 Answer 1

1

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] 
Sign up to request clarification or add additional context in comments.

1 Comment

Yes, this was the correct way, last night I had already discovered: D As always you are very kind BabyGau ... I still have a problem I can not solve this Tableview but when and if you have time to spare I'll tell you one thing that I can not explain why complicated and if I'm wrong to ask questions I spout Negative Ratings and demand is not taken into consideration are therefore incastarata :), also I do not wanna 'annoy too :) I have already abused too much of your kindness ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.