如何找到UIwindow上的触摸?

发布于 2024-09-16 16:35:56 字数 128 浏览 4 评论 0原文

我的 UIwindow 中有四个视图控制器。我想通过 UIWindow 中的 UItouch 在四个视图控制器之间交换视图控制器的视图?是否可以处理 appdelegate.m 文件中的 touchmoved 来更改这些视图控制器的框架起源?

i have four viewcontroller in my UIwindow.i want to interchange my viewcontroller's view among four through UItouch in UIWindow?is it possible to handle touchmoved in appdelegate.m file to change the frame origins of those viewcontrollers?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

等待圉鍢 2024-09-23 16:35:56

UIWindow 是 UIControl(接收触摸事件)的父类,因此它无法处理触摸事件。您应该将一个主 VC 作为 UIWindow 的子视图,然后使用该 VC 来交换后续 VC 和视图。

A UIWindow is the parent class of a UIControl (which is what receives touch events) so it cannot handle touch events. You should put one master VC as a subview to the UIWindow, and then use that VC to exchange the subsequent VC's and views.

哑剧 2024-09-23 16:35:56

您可以添加一个UIGestureRecognizer(其中UIPanGestureRecognizer)来任何视图处理来自任何其他对象的操作,使用手势的:

- (id)initWithTarget:(id)target action:(SEL)action;

You can add a UIGestureRecognizer (UIPanGestureRecognizer among them) to any view handle the action from any other object using the gesture's:

- (id)initWithTarget:(id)target action:(SEL)action;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文