通过手势在 2 个按钮之间画一条线
我是 iPhone 交互的初学者。我有 3 个按钮,一个在左边,另外 2 个在右边。我想用手指按下左边的按钮,并显示一条实时拉伸的线,手指在屏幕上移动,该线会转到我要转到右侧的另一个按钮 - 然后我到达右侧的按钮并释放我的手指线停留在屏幕上。
我应该从手册的哪里开始了解如何做这样的事情? - 请不要说第 1 页;-)
感谢您的所有指点,以便我可以自己学习和编写代码
干杯, 吉比
I am beginner for interactions on iphone. I have 3 buttons, one on the left, and the 2 other ones on the right. I would like to push the left button with finger and display a line real time stretching with my finger moving on screen that goes to the other button I am going to go to on the right - and then I reach the button on the right and release my finger the line stays on screen.
Where should I start in the manual to understand how to do something like this?
- please don't say page 1 ;-)
thanks for all the pointers so I can learn and write the code myself
Cheers,
geebee
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
哇,呃,你正在跳入深渊。
首先,您问题的答案是...查看 developer.apple.com 上的示例代码。通过使用这些示例项目,在调试器中运行它们,并阅读代码,您可以了解很多关于您想要做什么的信息。
使用这些示例作为教程,请参阅参考文档中的具体信息,也可从 developer.apple.com 获取。有关您将使用的类的特定文档(例如 UIButton 类参考),并且有一些讨论不同领域的高级指南,例如事件处理iOS 指南和绘图和iOS 打印指南。
以下是您将面临的一些问题,以及您应该阅读的一些区域:
UIButtons 将响应您的触摸,并且不允许任何其他视图接收该触摸在您的代码中无需进行一些特殊处理。
查看处理 UITouch 事件、Quartz 2D 绘图、创建自定义控件的示例
首先尝试在没有任何按钮的情况下执行此操作,这相当简单。只需弄清楚如何检测 TouchDownInside 事件、跟踪手指在屏幕上的移动以及检测 TouchUpInside 事件,所有这些都在普通的 UIView 中进行。 (可能有一个示例。)
Wow, uh, you're jumping right into the deep end.
First, the answer to your question is ... check out the Sample Code at developer.apple.com. By playing with those sample projects, and running them in the debugger, and reading that code, you can learn a whole lot about what you're trying to do.
Using those samples as your tutorial, refer to specific information in the reference docs also available at developer.apple.com. There are specific docs on the classes you'll be using (e.g. UIButton Class Reference), and there are high level guides that talk about different areas, like the Event Handling Guide for iOS, and Drawing and Printing Guide for iOS.
Here are some of the issues you're going to face, and some of the areas that you should read up on:
UIButtons are going to respond to your touch and won't allow any other view to receive that touch without some special handling in your code.
Check out samples that deal with UITouch events, Quartz 2D drawing, creating custom controls
Try doing this without any buttons first, that's fairly simple. Just figure out how to detect a TouchDownInside event, track the finger movement across the screen, and detect a TouchUpInside event, all in a normal UIView. (There may be a sample for this.)