2
我知道此代碼僅適用於UINavigationController
。是否可以用動畫隱藏UIToolbar?
[self.navigationController setNavigationBarHidden:YES animated:YES];
我知道此代碼僅適用於UINavigationController
。是否可以用動畫隱藏UIToolbar?
[self.navigationController setNavigationBarHidden:YES animated:YES];
這裏是代碼:
[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];
您可以修改工具欄 'Y' 的起源。
使用塊的示例。這會隱藏iPad屏幕頂部的工具欄。
[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;
}];