UITableView不滚动

Mar*_*oni 1 objective-c uitableview uiview uitouch ios

所以,这是我的观点:

在此输入图像描述

这是我的UItableViewDelegate和DataSource

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 20;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"course"];
    cell.textLabel.text = [NSString stringWithFormat:@"%i" ,arc4random() % 10];
    cell.detailTextLabel.text = [NSString stringWithFormat:@"%i" ,arc4random() % 10];
    return cell;
}
Run Code Online (Sandbox Code Playgroud)

这就是结果:

在此输入图像描述

问题是UItableView不滚动.决不.我真的无法弄清楚为什么......有人可以帮帮我吗?

Vin*_*ier 6

我已经看到了类似的事情,每次我看到这种行为都是因为一些观点正在捕捉触摸.

在clear中,检查视图Hierarchy以查看视图是否与tableView重叠(即使alpha为0.05的视图也可以识别和消化触摸).

我建议你采取控制器的根视图,并递归调用视图Hierarchy to NSLog图像的大小.

您也可以使用tableView执行此操作:

- (void)bringSubviewToFront:(UIView *)view
[self.view bringSubviewToFront:self.tableView];
Run Code Online (Sandbox Code Playgroud)

如果你的桌面视图在其他所有内容前面滚动,你会知道某些视图在表视图之前捕获了触摸.