The following code ensures that every time you navigate from A -> B -> A (via the Nav Controller's back button) -> B, B's init method is called every time (I'm using ARC here... if you aren't, let me know and I'll edit the example):
AppDelegate:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
viewControllerA *vcA = [[viewControllerA alloc] initWithNibName:@"viewControllerA" bundle:nil];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vcA];
self.window.rootViewController = nav;
[self.window makeKeyAndVisible];
return YES;
}
viewControllerA's button action method:
- (IBAction)moveForward:(id)sender {
// change this line to call your custom init method.
viewControllerB *vc = [[viewControllerB alloc] initWithNibName:@"viewControllerB" bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
}