【发布时间】:2014-02-01 17:17:36
【问题描述】:
我想在顶部栏显示一些通知而不显示导航栏和状态栏。 所以首先,我隐藏了两个条,显示一些通知,然后显示两个条。
我的问题是我可以隐藏栏并显示通知。但是当我尝试显示两个条时,它会影响通知。也就是说,当我隐藏条形图并显示动画消失的通知时,我可以检查条形图消失了。但是只要我把代码“显示栏”,通知显示,状态栏和导航栏也会显示。
我的代码如下:
隐藏导航栏
- (void)hideNavigationBar {
[[UIApplication sharedApplication] setStatusBarHidden:YES
withAnimation:UIStatusBarAnimationSlide];
isNavigationBarShowing = NO;
[UIView animateWithDuration:0.35 animations:^{
topBar.frame = CGRectMake(0, - topBar.frame.size.height, topBar.frame.size.width, topBar.frame.size.height);
}];
}
显示通知
- (void) showNotice {
[UIView animateWithDuration:0.3 animations:^{
noticeLabel.frame = CGRectMake(0, 0, 320, 64);
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.3 delay:1.0f
options:UIViewAnimationOptionCurveLinear animations:^{
noticeLabel.frame = CGRectMake(0, -85, 320, 64);
} completion:nil];
}];
}
- (void) showNavigationBar {
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];
isNavigationBarShowing = YES;
topBar.frame = CGRectMake(0, - topBar.frame.size.height, topBar.frame.size.width, topBar.frame.size.height);
[UIView animateWithDuration:0.35 animations:^{
topBar.frame = CGRectMake(0, statusBarHeight, topBar.frame.size.width, topBar.frame.size.height);
}];
}
我不知道我在处理隐藏导航栏和状态栏时遗漏了什么。请告诉我。提前致谢。
【问题讨论】:
标签: ios uinavigationcontroller uinavigationbar