views:

229

answers:

1

I have a controller that contains a tableView that spawns another controller modally to enter a name in. Once the name is entered the modalview is released. But... how do I tell the first controller to [tableView reloadData]. I have tried in the ViewWillAppear, ViewDidAppear, etc... none of them will fire off the command because the first controller is still there behind the modal controller. So.... how where can I tell it to reload?

THanks

+1  A: 

The way I would approach this would be to make the first controller a delegate of the second controller. Add a method like -secondController:didFinishEnteringName: to the first controller that reloads the tableview when called. Then add a delegate property (with assign semantics) to the second controller, set the first controller to be the second's delegate, and finally, after the user enters his name in the second controller, call the first controller's -secondController:didFinishEnteringName: method before removing the second controller from the screen.

Another approach might be to use notifications. But that's more applicable in situations where there may be many views or other objects that have to be updated.

Mike Akers
Thanks Mike........
Xcoder