Take the 2-minute tour ×

I'm writing iPhone application which periodically is syncing with the synchronization web service. Everything works ok, but unfortunately after synchronization user do not see any changes in the view if he visited it before.

I need to force to reload/refresh some of views. How could I do that with for example viewWillAppear method?

I've tried something like this in one of my view controllers:

-(void) viewWillAppear:(BOOL)animated   
        NSArray* sbw = [self.view subviews];

        UIView* view;
        for (view in sbw) 
            [view setNeedsDisplay];

        [self.view setNeedsDisplay];
        [super viewWillAppear];


But the subviews are not refreshing. Is there any method for forcing to reload/refresh view?

I know that viewWillAppear is executed when I move to this view but it's not refreshing - so how can I do that?

share|improve this question

2 Answers 2

in tableviews you could use : [tableView reloadData]; to reload a tables content. If you just want to update the views content you could just change it. Lets say if you have a view class and a controller class MyUIView and MyUIViewController and MyUIView does contain an UILabel * myLabel you could change the label text inside the controller by:

[((MyUIView *)self.view).myLabel setText:@"This is a new text."];

so no need for forcing update.

share|improve this answer

You can write the method "viewWillAppear" in that you can write your code to be reloaded which may take the data from your data base.This method will be executed when ever the view starts to load.

share|improve this answer

Your Answer


