I am not using storyboards. And currently in ViewController1. Here on a button click event I call this code.
InnerViewController *innerVc = [[InnerViewController alloc] initWithNibName:@"InnerViewController" bundle:nil titleText:@"vaibhav"];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:innerVc];
nav.restorationIdentifier = @"innerNavSR";
[self.navigationController presentViewController:nav animated:YES completion:nil];
And in InnerViewController restorationIdentifier
and restorationClass
is given. I have proper methods written for restoration.like
viewControllerWithRestorationIdentifierPath
encode and decode restoration.
If I change my
[self.navigationController presentViewController:nav animated:YES completion:nil];
to
[self.navigationController pushViewController:innerVc animated:YES];
It works fine. What am I missing or doing wrong with present. For a try I have even tried this :
[self presentViewController:nav animated:YES completion:nil];
But no use. Doesn't work.
Result when presenting is -
viewControllerWithRestorationIdentifierPath
and decodeRestorableStateWithCoder
are getting called. call is also coming in viewdidload
but not in viewwillappear
. and I am visually seeing Viewcontroller1
. However it is all fine with push
Is something special required with present ??