1

I have a "FairListViewController". This is the first ViewController. Here by touching a tableCell, I can go to next which is "MenuViewController". And there are two Button, "Product" for "ProductViewController" and "Events" for "EventViewController". I use "NavigationController" as a "rootViewController" in my appDelegate. Now when i touch "Product" button in "MenuViewController" in takes me to "ProductViewController" and touching "BackButton" it smoothly back to "MenuViewController". I did the same code for "ProductViewController", here it takes me to the "EventViewController" but after touching "BackButton", strangely it takes back to First Page which is "FairListViewController". I change the name of my IBAction Button name ( In "EventViewController" nib file) several times & reconnect with nib file, even delete the button from nib file and try with a new button, but the result is same! Can any one similar to this problem before. Any suggestion will be highly appreciable. Thanks a lot in Advance.

Here is my code :

IN MenuViewController (For ProductViewController Button):

- (IBAction)callProductGroups:(id)sender
{
ProductGroupViewController *productGroupViewController;

if(IS_IPHONE_5)
{
    productGroupViewController = [[ProductGroupViewController alloc] initWithNibName:@"ProductGroupViewController" bundle:nil];
}
else
{
    productGroupViewController = [[ProductGroupViewController alloc] initWithNibName:@"ProductGroupViewControlleriPhone4" bundle:nil];
}

productGroupViewController.topBarImageForAll = self.topBarImageForAll;
productGroupViewController.topBarButtonImageForAll = self.topBarButtonImageForAll;
productGroupViewController.buttonDividerImageForAll = self.buttonDividerImageForAll;
productGroupViewController.backgroundImageForAll = self.backgroundImageForAll;
productGroupViewController.backgroundImageiPhone4ForAll = self.backgroundImageiPhone4ForAll;

[self.navigationController pushViewController:productGroupViewController animated:YES];
}

In ProductViewController :

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

In MenuViewController (For EventViewController Button):

- (IBAction)callEvents:(id)sender
{
EventViewController *eventViewController;

if (IS_IPHONE_5)
{
    eventViewController=[[EventViewController alloc] initWithNibName:@"EventViewController" bundle:nil];
}
else
{
    eventViewController=[[EventViewController alloc] initWithNibName:@"EventViewControlleriPhone4" bundle:nil];
}

eventViewController.topBarImageForAll = self.topBarImageForAll;
eventViewController.topBarButtonImageForAll = self.topBarButtonImageForAll;
eventViewController.buttonDividerImageForAll = self.buttonDividerImageForAll;
eventViewController.backgroundImageForAll = self.backgroundImageForAll;
eventViewController.backgroundImageiPhone4ForAll = self.backgroundImageiPhone4ForAll;

[self.navigationController pushViewController:eventViewController animated:YES];    
}

In EvenViewController :

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

[There is no problem of Going to next ViewController, the problem is about Coming Back.]

4

1 回答 1

0
 Try instead of
    [self.navigationController popToRootViewControllerAnimated:YES]; 

Use
    [self.navigationController popViewControllerAnimated:YES];
于 2013-08-22T09:22:00.223 回答