逐步显示 UIView 并从另一个 UIView 后面向下滑动
我有一个矩形菜单式视图(视图 1),位于窗口下方约 100 像素处(即窗口上方有空间),并且需要对出现在屏幕下方的下拉内容(视图 2)进行动画处理来自视图 1。我需要动画从视图 1 的底部边界开始 - 就像 iOS 5 通知下拉菜单一样,除了从屏幕下方的特定点开始。
我不能简单地将视图 2 从屏幕外滑入,因为由于各种原因,我无法覆盖一个 UIView 来隐藏其运动,直到它到达视图 1 的下边缘。
我已经检查了这个答案 - 以编程方式显示 UIView - 但我不认为这是合适的,因为我希望菜单滑动,而不是滑动从静态起点揭示。而且,正如所指出的,我无法用另一个视图“隐藏”滑动视图。
如何向下滑动视图 2,使其在从另一个视图的下边界出现时显示出来,类似于 io5 通知下拉?
I have a rectangular, menu-style view (view 1) laid across the window approx 100 px down (i.e. there is space above it in the window), and need to animate drop-down content (view 2) appearing lower down the screen from view 1. I need the animation to start at the bottom boundary of view 1 - much as with the iOS 5 notification pull-down, except from a specific point further down the screen.
I can't simply slide view 2 in from off screen, since for various reasons I can't overlay a UIView that would hide its motion until it reached the lower edge of view 1.
I've checked out this answer - Programmatically reveal a UIView - but I don't believe it's appropriate since I want the menu to slide, not be revealed from a static start point. And, as pointed out, I can't "hide" the sliding view with another view.
How do I slide down view 2 so that it is revealed as it emerges from the lower boundary of another view, similar to the io5 notification pull-down?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将两个子视图包含在超级视图中,并剪裁其边界。因此,您将拥有超级视图(比方说应用程序窗口),并在其中有一个视图(已剪切边界)。我们称其为容器视图。该容器将起源于当前插入/始终可见的视图的任何 Y 坐标,但它的高度将延伸到足够高以包含完全展开的“滑动”第三个子视图。
因此,在容器视图中,您可以将第一个始终可见的视图(视图 1)放置在坐标 0x 0y 处,然后将滑动视图(视图 2)插入其下方,并相应设置视图 2 的框架 y 偏移量并具有足够的负值,以通过覆盖视图 1 和容器视图的剪切边界完全隐藏它。
当用户拖动(或您用来公开“滑动”视图的任何方式)时,第三个视图从始终存在的视图下方向下滑动,但始终保留在总体剪辑视图内。中提琴。
Contain both subviews in a superview with it's bounds clipped. So you'd have your superview (let's say app window), and within that a view (with bounds clipped). Let's call this a container view. This container would originate at whatever Y coordinate your current inserted/always visible view does, but it's height would extend tall enough to encompass the fully-expanded "sliding" third subview.
So within your container view, you'd place your first always visible view (view 1) at coordinates 0x 0y, and then you'd insert your sliding view (view 2) beneath that, with the frame y offset for view 2 set accordingly and at sufficient negative value to hide it completely by means of the over-layed view 1 and the clipped bounds of the container view.
As the user drags (or whatever means you use to disclose your 'sliding' view), the 3rd view slides down from below the always present view, but always stays within the overarching clipped view. Viola.