Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

TotalLuck

macrumors newbie
Original poster
Jan 3, 2009
21
0
Moreno Vallley
I am having trouble when i use

Code:
[self.navigationController popViewControllerAnimated:YES];

after i have saved user input data. The Data saves to CoreData correctly and is available when i restart the program or back up to the start view.

how can i get the tableview to refresh when it is pop'd back? i have to use the back button on that page and then re-navigate to the list or restart to get refreshed data

I tried to just push a new view but that ends up having the back button take them to the Add screen instead of the start view where i want it to go. however this method refreshes the data properly.

can/should i override the back button call in this spot? what is the method to do that? or just create a new button for that spot?

Code:
-(IBAction) saveShow
{
	NSLog(@"attempting to save ManagedObject");
	
	NSError *error;
	if (![managedObjectContext save:&error])
	{
		NSLog(@"did not save ManagedObject");
	}
	else
       {
	       NSLog(@"ManagedObject Saved!!");
	}

	NSLog(@"Events array count: %i",[eventsArray count]);
	
	[eventsArray insertObject:aShow atIndex:0];
	
	RootViewController *newView = [[RootViewController alloc]initWithStyle:UITableViewStyleGrouped];
	newView.title = @"list View";
	newView.eventsArray = self.eventsArray;
	
	NSManagedObjectContext *context = [self managedObjectContext];
	if (!context) {
		NSLog(@"context not created");
	}
	
	newView.managedObjectContext = context;
	
	[self.navigationController popViewControllerAnimated:YES];
	[newView release];
}

your help is greatly appreciated.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.