UINavigationController does not animate as required

Ok, I have a tab-based application with a navigation controller for each tab. When I am at the root of each navigation manager and I click on the view, the animation works fine, but when I am on the pushed view and I want to place it, the navigation controller gets animated, but not the view. This is what I use to put it:

[self.navigationController popViewControllerAnimated:YES];

and click it:

[self.navigationController pushViewController:activityController animated:YES];

any suggestion?

EDIT:

I have a tableView in the root controller. Every time I select a line, I run this code

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    ActivityViewController *activityController = [[ActivityViewController alloc] initWithNibName:@"ActivityViewController" bundle:nil];

    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [backButton setBackgroundImage:[UIImage imageNamed:@"BackButonItem"] forState:UIControlStateNormal];
    [backButton setBackgroundImage:[UIImage imageNamed:@"BackButonItem_Pressed"] forState:UIControlStateHighlighted];
    [backButton addTarget:self action:@selector(popBack) forControlEvents:UIControlEventTouchUpInside];
    [backButton setFrame:CGRectMake(15, 10, 55, 30)];
    UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];

    activityController.navigationItem.leftBarButtonItem = backButtonItem;
    activityController.navigationItem.hidesBackButton = YES;

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

and this is my popBack method:

- (void) popBack
{
    [self.navigationController popViewControllerAnimated:YES];
}
+3
source share
1 answer

Have you tried

[self.navigationController popToViewController:self animated:YES];

It seems that the problem is solved for many people.

0

All Articles