UIScrollView内部的UITableView滚动问题 [英] UITableView scrolling problems when inside a UIScrollView

查看:109
本文介绍了UIScrollView内部的UITableView滚动问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UIScrollView(带分页),我添加了三个UIViews。这些UIViews中的每一个都有一个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. 您的UITableViews在任何地方都被禁用吗?我会在 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

我猜那些不确定-fire回答但希望他们能帮助发现问题!

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

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

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