Search code examples
iphoneiosuitableviewanimationuitoolbar

UIToolBar animating incorrectly with view transition


I have a uitableview inside and uiview which is being presented in a navigation view (so it has a navigation menu). Under the navigation menu I have a uitoolbar appearing when the view loads and disappearing when the load is poped from the navigation stack.

The issue I am having with this is that when I animate this view onto the stack with normal animation transition right to left, the tableview dose not do this it just appears quickly before the view is finishe sliding into view. Then when you select the back button and the view begins to animate from left to right it dissipears before the end of the animation again.

I would like to know how to get this toolbar to animate with the rest of the view, right to left, left to right etc instead off appearing over the sliding effect abnormally.

This is how I call and dissmiss the toolbar at the moment.

- (void) viewWillAppear:(BOOL)animated 
{
    [self.navigationController setToolbarHidden:NO animated:NO];
    [self.navigationController.toolbar setFrame:CGRectMake(0, 60, 320, 30)];
    self.navigationController.toolbar.tintColor = [UIColor darkGrayColor];

    [SeriesTableView setFrame:CGRectMake(0, 30, self.view.frame.size.width, self.view.frame.size.height)];


    [super viewWillAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [self.navigationController setToolbarHidden:YES animated:NO];

    [super viewWillDisappear:animated];
}

which is pretty much the standard way of doing things. Any help would be greatly appreciated.


Solution

  • The toolbar property of the navigation controller is already onscreen, but is hidden from view. If you want a toolbar to animate on and off with a certain view, add the toolbar to that view. Then the toolbar will animate on and off as part of the view.