ios - 应用程序运行时更改自定义 View

标签 ios iphone

<分区>


想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post .

关闭 9 年前

我想制作一个像矩形一样的 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 - TabBarController 内的 TabBarController

下一篇:ios - 无法验证包,未使用苹果提交证书签名

相关文章:

ios - 如何在 Swift 的通知中发送枚举值?

ios - 如何将 "Location Services -> Authorization Status(Application)"默认设置为 "Never"

iphone - 在构建表格时如何在 UITableViewController 中显示 View ?

ios - 如何在 swift 中避免循环 segues

iphone - 如何使用 iOS 4.1 SDK 中新的 UIKeyboardTypeDecimalPad 功能

iphone - 如何使用 Wi-Fi 获取距离

iphone - iPhone OS 3.0 中的 iPod 库访问

iphone - JSON 驱动的 iOS MVC 架构

iphone - ios 将 float 属性添加到 UIButton 或派生

iphone - 如何诊断 iPad iPhone 应用程序中的 EXC_BREAKPOINT (SIGTRAP) 崩溃?