将事件从 UIScrollView 转发到 UIButton
我在 UIScrollView
内有一个 UIButton
。问题是 UIButton
不够大,无法填充整个 UIScrollView
。我希望能够将 UIScrollView
其他区域的触摸事件转发到 UIButton
。这是我的应用程序的屏幕截图:
http://imageshack.us/photo/my -images/405/img1410.png/
有谁知道该怎么做?
I got an UIButton
inside an UIScrollView
. The problem is that the UIButton
is not big enough to fill the entire UIScrollView
. I'd like to be able to forward the touch events in other areas of the UIScrollView
to the UIButton
. Here's a screenshot of my app:
http://imageshack.us/photo/my-images/405/img1410.png/
Does anyone knows how to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
UIButton
的高亮部分可以在调用doSomething
方法之前显示。The highlight of
UIButton
can be shown before calldoSomething
method.我不确定你可以以这种方式转发触摸,但我想你可以调整 UIButton 的大小以填充整个滚动视图并使内容不拉伸,这样它看起来相同,但会有一个更大的 UIButton。
I'm not sure you can forward touches in that manner, but I guess you could resize the UIButton to fill the whole scrollView and make the content not stretch, such that it looks identical, but there'd be a much bigger UIButton.
要将触摸沿着链传播到子视图,请
在scrollView的touchesBegan中使用:。
To propagate touches down the chain to a sub view use:
in your scrollView's touchesBegan.