0

My app contain 5 xib
When i navigate to Home to 2nd View and BACK to Home is work fine
But From 3rd View and Tap for BACK its Every Time Push to Home View, I have Try this

-(IBAction)doBack
{
[self.navigationController popViewControllerAnimated:YES];
}

in .xib file added UIView and in that View add a UIButton .

  • also Tried pushViewControllerAnimatede:
  • and popToviewController: animated:

I have Mac OSX 10.8.3 , IOS 6 , Xcode 4.5.2

I think some How Stack is not Maintain but dont know how ????

Denny
  • 285
  • 1
  • 2
  • 16

1 Answers1

0

I have used different xibs for singleView controller and apply buttons on every xib to push and pop and it is working fine.My code is displayed below:--

- (IBAction)pushToFourth:(id)sender {
    SPTViewController *viewController=[[SPTViewController alloc] initWithNibName:@"FourthView" bundle:nil];
    [self.navigationController pushViewController:viewController animated:YES];
}

- (IBAction)pushToThird:(id)sender {
    SPTViewController *viewController=[[SPTViewController alloc] initWithNibName:@"ThirdView" bundle:nil];
    [self.navigationController pushViewController:viewController animated:YES];
}

- (IBAction)pushtoSecond:(id)sender
{
    SPTViewController *viewController=[[SPTViewController alloc] initWithNibName:@"SecondView" bundle:nil];
    [self.navigationController pushViewController:viewController animated:YES];
}

- (IBAction)poptofirst:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

- (IBAction)poptosecond:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

- (IBAction)poptothird:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}
Prince Kumar Sharma
  • 12,591
  • 4
  • 59
  • 90