Reputation: 25964
Have you animated the appearance of the Toolbar - I am unable to get it to animate
This:
[self.navigationController setToolbarHidden:NO animated:YES];
Or this:
[UIView animateWithDuration:2.0
animations:^{
[self.navigationController setToolbarHidden:NO
animated:YES];
}
completion:^(BOOL finished){
// whatever
}];
}
In both
- (void)viewDidAppear:(BOOL)animated{
- (void)viewWillAppear:(BOOL)animated{
}
Upvotes: 3
Views: 1193
Reputation: 130193
This should work if your tool bar is actually added by the navigation controller. However, since it isn't it's leading me to believe that you've added the toolbar manually via drag and drop in interface builder. If that is the case, you'll have to create an IBOutlet for the toolbar, link it, and then use:
[UIView animateWithDuration:0.2 animations:^{
[myToolBar setFrame:CGRectMake(myToolBar.frame.origin.x, myToolBar.frame.origin.y + myToolBar.frame.size.height, myToolBar.frame.size.width, myToolBar.frame.size.height)];
}];
Upvotes: 1
Reputation: 25964
This did actually work:
- (void)viewDidAppear:(BOOL)animated{
[self.navigationController setToolbarHidden:NO animated:YES];
}
The animation should not start until the view is visible.
Upvotes: 2
Reputation: 3251
This should do the trick, with a UIToolbar created and linked from IB:
[UIView beginAnimations:@"animate" context:nil];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.25f];
self.toolbar.frame = CGRectOffset(self.toolbar.frame, 0, direction*self.test.toolbar.size.height);
[UIView commitAnimations];
where "direction" is +/-1 depending on the movement direction (+ to move down, - to move up)
Upvotes: 2