<分区>
我想制作一个像矩形一样的 View (扩展 UIView),将其添加到主视图中。 当应用程序运行时,我可以调整大小或旋转、缩放...矩形。
我该怎么办?我创建了一个 Rectangle_View,并尝试在网络上阅读更多教程,但我无法找到解决方案。
非常感谢
最佳答案
您可以使用以下方法管理触摸:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
记得调用super
将消息转发给下一个响应者!!
查看有关 UIResponder 的文档。 我还建议看看this sample code演示如何处理触摸,包括多次触摸以及如何移动多个对象。
关于ios - 应用程序运行时更改自定义 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21993164/
相关文章:
ios - 如何将 "Location Services -> Authorization Status(Application)"默认设置为 "Never"
iphone - 在构建表格时如何在 UITableViewController 中显示 View ?
iphone - 如何使用 iOS 4.1 SDK 中新的 UIKeyboardTypeDecimalPad 功能
iphone - iPhone OS 3.0 中的 iPod 库访问
iphone - ios 将 float 属性添加到 UIButton 或派生
iphone - 如何诊断 iPad iPhone 应用程序中的 EXC_BREAKPOINT (SIGTRAP) 崩溃?