gpt4 book ai didi

objective-c - UITableView 不滚动

转载 作者:行者123 更新时间:2023-12-01 15:52:37 25 4
gpt4 key购买 nike

所以,这是我的观点:

enter image description here

这是我的 UItableViewDelegate 和数据源

-(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;
}

这是结果:

enter image description here

问题是 UItableView 不滚动。绝不。我真的想不通为什么...有人可以帮助我吗?

最佳答案

我见过类似的事情,每次我看到这种行为都是因为某些 View 正在捕捉触摸。

明确地说,检查您的 View 层次结构以查看 View 是否与您的 tableView 重叠(即使 alpha 为 0.05 的 View 也可以识别和消化触摸)。

我建议您采用 Controller 的 Root View 并递归调用 View 层次结构以 NSLog 图像的大小。

你也可以用你的 tableView 做这个:

- (void)bringSubviewToFront:(UIView *)view
[self.view bringSubviewToFront:self.tableView];

如果你的 tableview 在其他所有东西前面滚动,你肯定会知道某个 View 在 table view 之前捕获触摸。

关于objective-c - UITableView 不滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13733354/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com