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.
我正在开发一个 iPhone 应用程序,我正在尝试解决以下问题。在我的主视图控制器视图中,我将另一个视图控制器的视图添加为子视图。但是另一个视图控制器的 touchesbegan 函数不响应触摸。解决此问题的最佳方法是什么?
不确定您在做什么,但自 iOS 5 以来,不鼓励将一个控制器的视图添加为子视图是另一种。在 iOS 5 中,您可以使用该方法UIViewController在彼此之间包含 s 。这个答案提供了对此事的一些见解。addChildViewController
UIViewController
addChildViewController
更新 Apple 的遏制文档。