views:

42

answers:

1

Hi all,

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?

A: 

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.

hhamm