ScrollView 中没有可见部分的按钮
Button inside no visible part of a ScrollView
在图片中你可以看到我的 Storyboard 的结构: View -> ScrollView -> ContentView (view) -> Views 。在 phone 中,蓝色图像中的按钮出现在屏幕外,当我将滚动条移至它时,该按钮未检测到点击。
我在很多论坛上看过,我添加了这个:
scrollView.userInteractionEnabled = Bool(true);
scrollView.exclusiveTouch = Bool(true);
scrollView.canCancelContentTouches = Bool(true);
scrollView.delaysContentTouches = Bool(true);
在 StoryBoard 中,我标记为 de ScrollView "Delays Content Touches",并标记为按钮 "User interaction enabled"
我不知道该怎么办。
发布答案以供其他人查看:
在故事板中添加带有内容视图的滚动视图时,请确保滚动视图中内容视图的内容大小等于滚动视图的内容大小。
否则,您的内容视图将不会检测到 phone 屏幕高度范围之外的触摸。
很高兴能帮到您!
在图片中你可以看到我的 Storyboard 的结构: View -> ScrollView -> ContentView (view) -> Views 。在 phone 中,蓝色图像中的按钮出现在屏幕外,当我将滚动条移至它时,该按钮未检测到点击。
我在很多论坛上看过,我添加了这个:
scrollView.userInteractionEnabled = Bool(true);
scrollView.exclusiveTouch = Bool(true);
scrollView.canCancelContentTouches = Bool(true);
scrollView.delaysContentTouches = Bool(true);
在 StoryBoard 中,我标记为 de ScrollView "Delays Content Touches",并标记为按钮 "User interaction enabled"
我不知道该怎么办。
发布答案以供其他人查看:
在故事板中添加带有内容视图的滚动视图时,请确保滚动视图中内容视图的内容大小等于滚动视图的内容大小。
否则,您的内容视图将不会检测到 phone 屏幕高度范围之外的触摸。
很高兴能帮到您!