i have viewcontroller with table view that when i click on a cell i go in the navigation to another view controller with another tableview.
i try to use the viewDidAppear and viewWillAppear in the first viewcontroller, that when i back to this viewcontroller from the second viewcontroller i will enter one of this method.
the problem is that he didn’t enter this method when i return to this viewcontroller.
this is how i enter the second view controller:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
ProfileViewController2 *tmp = [[ProfileViewController2 alloc]initWithType:indexPath.row string:[self.array2 objectAtIndex:indexPath.row]];
[[self navigationController] pushViewController:tmp animated:YES];
[tmp release];
[self.mytableview deselectRowAtIndexPath:indexPath animated:YES];
}
viewWillAppearandviewDidAppearare notoriously shaky on iOS.If you are working with
UITableViews we always put the code we need to run before the table gets loaded into thefunction. It’s a slight hack but works very well as this is the first function out of the UITableViewDataSource protocol called.
Alternatively, you can call
After pushing the view controller and before releasing
tmpto force the function being called.