問題描述
我有一個 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 滾動問題的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!