According to my project design, the navigation stack structured like below: Splash Screen -> Home -> Event Listing -> Event Details
Now, i use Custom Url which the Url calls 'Home' page. So, I want to change the Navigation Stack structure like below: Splash Screen -> Home
Through my knowledge, my code facing some memory problem:
I can code that only reach the stack like: Splash -> Home -> Home -> Home -> …. and so on, whenever i use custom url.
Otherwise, using popToviewController I can reach the stack like: Splash -> Home -> Home
But, the push successfully happened but the view not change.
Code below:
navigationArray = [[NSMutableArray alloc] initWithArray: self.nav.viewControllers];
for(int k=[navigationArray count]-1;k>=0;k--){
if ([[navigationArray objectAtIndex:k] isKindOfClass:[Home class]]){
//UIViewController *controller=[navigationArray objectAtIndex:k];
id obj=[navigationArray objectAtIndex:k];
[[self nav] popToViewController:obj animated:YES];
}
}
if(IS_IPAD)
class=[[Home alloc] initWithNibName:@"Home_iPad" bundle:Nil];
else
class=[[Home alloc] initWithNibName:@"Home" bundle:[NSBundle mainBundle]];
[self.nav pushViewController:class animated:YES];
NSLog(@"Finally, In Nav: %@", [self.nav viewControllers]);
This prints like below:
"Splash: 0xcea0c70",
"Home: 0xd193400",
"Home: 0xd470600".
That is, Splash -> Home -> Home. But, Simulator displays the Home: 0xd193400 not the Home: 0xd470600. Why?