Reputation: 2652
I have a view controller called searchUpdateController
, it has a button to push a new view controller called editController. In the editController there is a button called Save and it contains the following code:
searchUpdateController = [[SearchUpdate alloc] init];
[self.navigationController popViewControllerAnimated:YES];
[searchUpdateController.fieldsValArray replaceObjectAtIndex:3 withObject:joinedString];
[searchUpdateController.mainTable reloadData];
[searchUpdateController release];
fieldsValArray
is a NSMutableArray
property in searchUpdateController
and mainTable is the tableView in the searchUpdateController
. I wanted to update the content of the fieldsValArray
and reload the data of the tableView. Nothing happens when I click the Save button. Any ideas what I'm missing here?
Upvotes: 1
Views: 115
Reputation: 14118
Dont do this -> searchUpdateController = [[SearchUpdate alloc] init]; Here you are creating new object, which is not referring to your older object
Before moving back to searchUpdateController do this:
Now there are two possibilities to reload data:
Hope this is what you want.
Upvotes: 1
Reputation: 39988
Here you are creating a new objet not using the old one in the code
searchUpdateController = [[SearchUpdate alloc] init];
set them searchUpdateController
from SearchUpdateController
class. so that it point to that object that pushes the editController
Upvotes: 1