如何让 UIView 从 UINavigationBar 下滑出?
目前,我正在显示一个 UIView,它从窗口顶部向下滑动到一个位置:
-(void)showNotificationBar
{
[notificationBar setFrame: CGRectMake(0, 0, 320, 44)];
[[[UIApplication sharedApplication] keyWindow] addSubview:notificationBar];
[UIView animateWithDuration:0.5
delay:0.0
options: UIViewAnimationCurveEaseInOut
animations:^{
[notificationBar setFrame: CGRectMake(0, 59, 320, 32)];
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];
}
我希望它从 UINavigationBar 下方滑出。现在它从窗口顶部滑动到导航栏的底部。我希望它从导航栏底部滑动以显示自身。现在确切知道该怎么做吗?
Currently I am displaying a UIView that slides down from the top of my window to a position:
-(void)showNotificationBar
{
[notificationBar setFrame: CGRectMake(0, 0, 320, 44)];
[[[UIApplication sharedApplication] keyWindow] addSubview:notificationBar];
[UIView animateWithDuration:0.5
delay:0.0
options: UIViewAnimationCurveEaseInOut
animations:^{
[notificationBar setFrame: CGRectMake(0, 59, 320, 32)];
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];
}
I want this to slide out from under my UINavigationBar. Right now it is sliding from the top of the window, to the bottom of my navigation bar. I want it to slide from the bottom of the navigation bar to display itself. Now exactly sure how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您将在窗口中所有其他视图的顶部添加
notificationBar
。您需要将其添加为导航栏超级视图的子视图,位于导航栏下方。假设您的
UINavigationBar
位于属性self.navBar
中。试试这个:You're adding
notificationBar
on top of all other views in your window. You need to add it as a subview of the nav bar's superview, below the nav bar.Let's say your
UINavigationBar
is in a propertyself.navBar
. Try this:快速浏览一下,您似乎想研究如何“遮罩”图层。
看看这篇文章。
“屏蔽”动画? iPhone SDK
如果您要将下拉菜单隐藏在视图(隐藏视图)下,您可以显示动画,而不会看起来它来自导航栏上方,而是来自导航栏下方。
A quick look at this and it looks like you want to research how to "Mask" a layer.
Take a look at this post.
"Masking" an animation? iPhone SDK
If you were to mask your drop down menu under a view (a hidden view) you could get the animation to show without looking like it came from above your navigation bar, but below it.