开发者

UIView added to a ScrollView and touchesDidBegin issue

开发者 https://www.devze.com 2023-02-18 06:09 出处:网络
Im adding a UIView as a subView to a scrollView. However, I wish to detect touches in the UIView. But i notice that when i do something like this:

Im adding a UIView as a subView to a scrollView. However, I wish to detect touches in the UIView. But i notice that when i do something like this:

[s开发者_StackOverflow中文版elf.myScrollView addSubview:myView];

then, the touchesDidBegin method is never called when i touch the subview. However, if i do the following,

[self.view addSubview:myView];

then, the touchesDidBegin method is called. However, now the subView does not scroll along with the scroller obviously.

I want "myView" to be added to the scrollView as a subview so that it scrolls along with it and also detects touches on it. Any way to accomplish this?


The same has already discussed here, plz find the link to similar SO post.

Handling touch events within a child UIScrollView

Touch events not working on UIViews inside UIScrollView uiscrollview

0

精彩评论

暂无评论...
验证码 换一张
取 消