开发者

Is it possible to hide a UIToolbar with an animation?

开发者 https://www.devze.com 2022-12-12 20:52 出处:网络
I know this code is available to UINavigationController only. [self.navigationController setNavi开发者_如何学GogationBarHidden:YES animated:YES];

I know this code is available to UINavigationController only.

[self.navigationController setNavi开发者_如何学GogationBarHidden:YES animated:YES];


An example using blocks. This will hide a toolbar at the top of an iPad screen.

[UIView animateWithDuration:.7 
                 animations:^(void)
                 {
                     CGRect toolbarFrame = self.toolbar.frame;
                     toolbarFrame.origin.y = -44; // moves iPad Toolbar off screen
                     self.toolbar.frame = toolbarFrame;
                 } 
                 completion:^(BOOL finished)
                 {
                     self.toolbar.hidden = YES;
                 }];


Here is the Code:

[UIView beginAnimations:@"hideView" context:nil];
[UIView setAnimationDuration:0.7];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:toolBar cache:YES];
toolbarFrame.origin.y = 380;
toolBar.frame = toolbarFrame;
[UIView commitAnimations];

you can modify the toolBar 'y' origin.

0

精彩评论

暂无评论...
验证码 换一张
取 消