views:

403

answers:

1

My UITable View does not refresh from its data source of an array, which is edited but the Modal view controller.

I have confirmed that the editing works fine.

And I have this tried these,

- (void)viewWillAppear:(BOOL)animated
{
[myTableView reloadData];
NSLog(@"Routines: %@", routines);
NSLog(@"refreshed!");



}

and

[self.myTableView reloadData]; 

but to no luck, and the method is being called, because 'refreshed!' is being logged.

So, what am i doing wrong? perhaps something in IB? The Table view does display with some initial data. So this leads me to think that the delegate and the data source works just fine. So im totally confused.

+1  A: 

do you change you "numberOfRowsInSection" ?

nathanjosiah
this is the method - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [routines count]; }
Sam Jarman
did you nslog to make sure the data gets tranferred back to the tableview? for(int i = 0; i < [routines count]; i++){ nslog([routines objectAtIndex:i];}
nathanjosiah
i nsloged to make sure the data got put into the array, which is the data source for the table view.
Sam Jarman
so, the data is going there. its just not showing up,does -reloadData run through the tableView methods and redo them?
Sam Jarman
do you change your routines array in any of the tableview methods?
nathanjosiah
i only draw the cell out of it. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; } // Set up the cell... NSString *cellValue = [routines objectAtIndex:indexPath.row]; [cell.textLabel setText:cellValue]; return cell; }
Sam Jarman
how are you transferring the array from one controller to the other?
nathanjosiah