我知道此代码仅供UINavigationController
使用。
[self.navigationController setNavigationBarHidden:YES animated:YES];
答案 0 :(得分:9)
使用块的示例。这将隐藏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;
}];
答案 1 :(得分:1)
以下是代码:
[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];
你可以修改toolBar'y'的来源。