Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
好的,我真的在为此苦苦挣扎!
我知道必须将图像添加到视图中,我知道如何记录触摸事件。但事实证明,将两者结合起来是一个问题。
有很多关于如何使用触摸事件移动图像的教程。
但是任何人都可以建议我如何完成以下内容:
任何建议将不胜感激
假设您只想让图像出现和消失,您可以在 UIViewController 中为要截取触摸事件的视图实现 UITouch 事件处理方法。有关如何执行此操作的示例可以在“iPhone 编程指南:事件处理”位于:
http://developer.apple.com/IPhone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/EventHandling/EventHandling.html#//apple_ref/doc/uid/TP40007072-CH9
一旦你设法拦截了触摸事件,你可以简单地将 UIImageView 添加为你希望它出现的视图的子视图。
我希望这会有所帮助。