UIScrollView 内的 UITableView 滚动问题

UITableView scrolling problems when inside a UIScrollView(UIScrollView 内的 UITableView 滚动问题)
本文介绍了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.

提前致谢!

推荐答案

我要检查的事情:

  1. 检查您的视图层次结构 - 是否有东西放置在您的 UITableView 之上,导致它没有收到点击?
  2. 您的 UITableView 是否在任何地方都被禁用了?我会在 tableView:didSelectRowAtIndexPath: 中设置一个断点,看看是否正在调用该方法.
  3. 查看这篇文章
  1. Check your View Hierarchies - Is something being laid on top of your UITableView, causing it not to receive a tap?
  2. Are your UITableViews being disabled anywhere? I would set a breakpoint in tableView:didSelectRowAtIndexPath: and see if that method is being called.
  3. Check this post

我猜这些不是肯定的答案,但希望它们能帮助发现问题!

I guess those aren't sure-fire answers but hopefully they'll help discover the problem!

这篇关于UIScrollView 内的 UITableView 滚动问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Stop a UITableView from automatically scrolling(阻止 UITableView 自动滚动)
iOS UIScrollView Lazy Loading(iOS UIScrollView 延迟加载)
using iOS 6.0 SDK and building for iOS 5 Target causes UIScrollView setMinimumZoomScale to fail when running on iOS 5 simulator(在 iOS 5 模拟器上运行时,使用 iOS 6.0 SDK 并为 iOS 5 Target 构建会导致 UIScrollView setMinimumZoomScale 失败) -
Create partial-screen UIPageViewController programmatically(以编程方式创建部分屏幕 UIPageViewController)
how to make an ImageView zoomable with or without ScrollView.?(如何使用或不使用 ScrollView 使 ImageView 可缩放?)
UIImageView zoom and pinch in UIScrollView(UIImageView 在 UIScrollView 中缩放和捏合)