UIButton在UIScrollview中设置框架后不响应 [英] UIButton not responding after set frame within UIScrollview
问题描述
我有一个UIScrollView的内容是用Interface Builder设计的。它有一个带有UIButton的表。如果按钮没有被移动,它的工作原理(touchesBegan和TouchUpInside被调用),但如果它是使用'button.frame ='响应内容增长(表更大)移动,它停止响应任何触摸。
我确认前面没有隐藏视图,我甚至使用bringViewToFront。
检查您的UIButton最终位置是否在 UITableView
和 UIScrollView
p>
移动后, UIBUtton
可能会放在边界之外,然后不会响应触摸事件。
一键设置,可以让您验证是否设置<$ c> clipToBounds 属性 $ c> UITableView
和 UIScrollView
到 NO
,则放置在界限外的所有内容甚至不可见。
I have a UIScrollView which content is designed with Interface Builder. It has a table with a UIButton below. If the button wasn't moved before, it works (touchesBegan and TouchUpInside get called), but if it was moved using 'button.frame = ' in response of content growth (the table got bigger), it stops responding to any touch.
I verified that there's no hidden view in front of it, I even used bringViewToFront.
Check if your UIButton final position is both inside the UITableView
and UIScrollView
bounds.
It is possible that after you moved, the UIBUtton
is placed outside the bound, and then will not respond to touch events.
One click set up that can make you verify that is to set the clipToBounds
property of your UITableView
and UIScrollView
to NO
, then all content placed outside the bounds will not even be visible.
这篇关于UIButton在UIScrollview中设置框架后不响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!