UIButton在UIScrollview中设置框架后不响应 [英] UIButton not responding after set frame within UIScrollview

查看:724
本文介绍了UIButton在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆