如何从当前视图顶部的侧面滑动 UIView (iPhone)
目前我有一个包含 MKMapView 的视图。我还有一个单独的 UIView(在 IB 中制造),我想将其滑动到现有视图上。
我想要执行此操作的方法是从左侧滑动视图,同时减小地图视图的大小。
我还希望相反的情况是可能的,这样视图将滑向左侧,并且地图视图将扩展以填充间隙。
唯一的问题是我希望这是一个流畅的动画。我知道如何在顶部显示 UIView,然后调整地图视图的大小,但这看起来很笨重。我更喜欢 iAd 横幅在屏幕上滑动时看到的效果(但地图视图的大小调整速度与 UIView 在屏幕上的移动速度相同)。
抱歉,如果这是一件简单的事情,这是我第一次使用动画。
提前致谢。
At the moment I have a view that contains an MKMapView. I also have a separate UIView (Made in IB) that I want to slide onto the existing view.
The way I want to do this is to slide the view from the left hand side, while at the same time reducing the size of the map view.
I also want the reverse to be possible, such that the view will slide off to the left and the map view will expand to fill the gap.
The only catch is that I want this to be a nice smooth animation. I know how to display the UIView on top and then resize the map view, however this appears quite clunky. I'm more after the effect you see when an iAd banner slides on and off the screen (but with the map view resizing at the same rate as the UIView moves on-screen).
Sorry if this is a simple thing to do, this is my first time working with animations.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最简单的方法是使用 UIView 动画方法。像这样:
反之亦然,但帧大小不同。
The simplest way is to use the UIView animation methods. Something like this:
And the reverse is similar, but with different frame size.
这是我使用 UIView 动画完成的。您可以根据需要更改帧大小。
This is i have done using UIView animation.You can change the frame size according to your need.