UITableView scrolling problems when inside a UIScrollView(UIScrollView 内的 UITableView 滚动问题)
问题描述
我有一个 UIScrollView(带有分页),我向其中添加了三个 UIView.这些 UIView 中的每一个内部都有一个 UITableView.因此,用户应该能够水平滚动到他想要的页面,然后在相应的表格中垂直滚动.
I have a UIScrollView (with paging) to which I add three UIViews. Each of these UIViews has a UITableView inside. So, the user should be able to scroll horizontally to the page he wants and then scroll vertically in the corresponding table.
但是,有些表格不接收滚动手势.通常第一个确实表现良好,但其他的则不然.我无法选择单元格,也无法上下滚动表格.
However, some of the tables don't receive the scrolling gestures. Usually the first one does behave good, but the other ones do not. I can't select cells nor scroll the table up or down.
我使用 UIScrollView 的默认设置,除了 viewDidLoad 中定义的这些设置:
I used the default settings for the UIScrollView, except for these ones defined in the viewDidLoad:
- (void)viewDidLoad
{
[super viewDidLoad];
//Load the view controllers
[self loadViewControllers];
//Configure the scroll view
self.scrollView.pagingEnabled = YES;
self.scrollView.contentSize = CGSizeMake(CGRectGetWidth(self.scrollView.frame) * viewControllers.count, CGRectGetHeight(self.scrollView.frame));
self.scrollView.showsHorizontalScrollIndicator = NO;
self.scrollView.showsVerticalScrollIndicator = NO;
self.scrollView.scrollsToTop = NO;
self.scrollView.delegate = self;
//Configure the page control
self.pageControl.numberOfPages = viewControllers.count;
self.pageControl.currentPage = 0;
}
我不知道为什么我不能滚动某些表格...任何帮助将不胜感激.
I can't figure out why I can't scroll some of the tables... Any help would be greatly appreciated.
提前致谢!
推荐答案
我要检查的事情:
- 检查您的视图层次结构 - 是否有东西放置在您的 UITableView 之上,导致它没有收到点击?
- 您的 UITableView 是否在任何地方都被禁用了?我会在
tableView:didSelectRowAtIndexPath:
中设置一个断点,看看是否正在调用该方法. - 查看这篇文章
- Check your View Hierarchies - Is something being laid on top of your UITableView, causing it not to receive a tap?
- Are your UITableViews being disabled anywhere? I would set a breakpoint in
tableView:didSelectRowAtIndexPath:
and see if that method is being called. - Check this post
我猜这些不是肯定的答案,但希望它们能帮助发现问题!
I guess those aren't sure-fire answers but hopefully they'll help discover the problem!
这篇关于UIScrollView 内的 UITableView 滚动问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:UIScrollView 内的 UITableView 滚动问题


基础教程推荐
- NSString intValue 不能用于检索电话号码 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01