[英]UITableView doesn't scroll
所以,这是我的看法:
这是我的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;
}
结果如下:
问题是UItableView无法滚动。 决不。 我真的不知道为什么...有人可以帮助我吗?
我见过类似的情况,每次见到此行为都是因为某些视图捕捉到了触摸。
明确地说,检查视图层次结构以查看视图是否与tableView重叠(即使alpha值为0.05的视图也可以识别并消化触摸)。
建议您使用控制器的根视图,然后递归调用视图层次结构以NSLog记录图像的大小。
您也可以使用tableView执行此操作:
- (void)bringSubviewToFront:(UIView *)view
[self.view bringSubviewToFront:self.tableView];
如果您在其他所有事物面前都在滚动视图,那么您肯定会知道某个视图正在捕获该视图之前的触摸。
尝试说出self.tableView.userInteractionEnabled = YES;
实现时钟视图后。
如果这不起作用,请尝试[self.view bringSubviewToFront:self.tableView];
我试图达到类似的结果,并且对我来说效果很好。 尝试检查您的选项
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.