制作拉出托盘-(iOS) [英] Making a pull out tray - (iOS)

查看:146
本文介绍了制作拉出托盘-(iOS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个iPad应用程序,基本上,我想制作一个从应用程序底部拉出的托盘,并且我想在屏幕底部有一个小标签,如果您拉出,它将弹出一个图像,并且图像的高度将与您将按钮拉至的高度相匹配.通知中心的工作方式有点像,但该选项卡始终可见.

I'm making an iPad app, and basically, I want to make a tray that pulls out from the bottom of my app, and I'd like to have a little tab at the bottom of the screen that if you pull, it brings up an image, and the image's height would match the height you pulled the button to. It's a bit like how the notification center works, except the tab is always visible.

所以我的问题是,当图像在屏幕上垂直移动时,如何使图像跟随选项卡?我认为对于选项卡使用UIButton,对于托盘使用UIImage是有意义的,并且我有一些使按钮移动的代码,但是如何使一个对象跟随另一个对象呢?

So my question is how would I have the image follow the tab as it moves vertically across the screen? I would assume using a UIButton for the tab and a UIImage for the tray would make sense, and I have some code for making buttons move, but how can you make one object follow another?

感谢您的帮助, -卡尔

Thanks for your help, -Karl

推荐答案

我不会在选项卡上使用按钮-只是常规的旧视图.

I wouldn't use a button for the tab -- just a regular old view.

要使图像跟随选项卡(无论如何实现它们),只需将它们同时设置为动画即可.也就是说,如果您创建了将按钮的中心移动到用户触摸的Y坐标的动画,则可以同时垂直将图像垂直移动相同的量.然后,这两个对象似乎会粘在一起,因为它们一起移动.

To make your image follow the tab (however you implement either of them), simply animate them both together. That is, if you create an animation that moves the center of the button to the Y-coordinate of the user's touch, you can at the same time move the image vertically by the same amount. The two objects will then seem glued together because they move together.

这篇关于制作拉出托盘-(iOS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆