views:

171

answers:

0

I'm using the Utilities Xcode template for my iPhone app. I am trying to find out how to reload the mainview after I come back from the flipview. Seems like the searches I've done come back with the older version of the Utilities template that I do not have. Apple seems to have redone it for 3.0.

What I tried to do was put a method in the mainview that reloads the table view on the mainview, and call that method when I come back from the flipview. I must be missing something, because it does not work.

I placed in MainViewController.h

- (void) reloadMainView;

I placed in MainViewController.m

- (void) reloadMainView {
    [tableView reloadData];
}

In FlipViewControlller.m I added

[MainViewController reloadMainView];

to the "done" method like this:

- (IBAction)done {
    [self.delegate flipsideViewControllerDidFinish:self]; 

    UIViewAnimationTransition transition;
    transition = UIViewAnimationTransitionFlipFromLeft;

    [MainViewController reloadMainView];
}

The app still builds and runs. It still flips, but the MainView never reloads and I get the error in FlipsideViewContrller.m:

'MainViewController' may not respond to '+reloadMainView' (Methods without a matching method signature will be assumed to return 'id' and accept '...' as arguments.)

Then someone told me to try this:

I put this in mainviewcontroller.h

- (void)viewWillAppear:(BOOL)animated;

and this in mainviewcontroller.m

- (void)viewWillAppear:(BOOL)animated {

    [tableView reloadData];
}

But what goes in my flipviewcontrolller to call it when you flip back to the mainview?

I'm stuck, please help. Thanks