简体   繁体   中英

touchesbegan doesn't work on subview from second viewcontroller

I'm developing an iPhone app and I am trying to solve the following problem. In my main viewcontroller view I add the view of an other viewcontroller as subview. But the touchesbegan function of the other viewcontroller doesn't respond to the touches. What is the best way to fix this problem?

Not sure what you are doing this but adding views of one controller as a subview is another has been discouraged since iOS 5. In iOS 5 you can contain UIViewController s within each other using the addChildViewController method. This answer provides a bit insight into the matter.

Update Apple's Documentation on containment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM