Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Animate setToolbarHidden not animated

Tags:

ios

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{
}
like image 529
Chris G. Avatar asked Jun 27 '26 21:06

Chris G.


1 Answers

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)

like image 82
Ricardo RendonCepeda Avatar answered Jun 29 '26 11:06

Ricardo RendonCepeda



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!