gpt4 book ai didi

ios - UITableView 优于 UITableViewCell didSelectMethod

转载 作者:行者123 更新时间:2023-11-29 02:24:18 25 4
gpt4 key购买 nike

这一定是个愚蠢的问题,

一些我怎么知道原因但很难找到解决方案。所以任何帮助都将受到欢迎..

我拥有的是一个带标题的 UITableView。 header 包含问题,UITableViewCell 包含问题选项。

每个单元格都有 3 个控件,2 个标签和 1 个按钮。

1 个标签包含选项,其他包含其答案。要匹配答案,您必须从下拉菜单中选择选项,单击该单元格中的按钮时会打开该选项。

那个下拉列表又是一个 UITableView。哪些选项。以便在 UITableViewCell 上添加 DropDownTableView。

但问题是,当我打开那个单元格的下拉菜单时,表格超出了单元格的边界,所以 DropDown 表的 DidSelectMethod 没有被调用。

我无法增加 BaseTableVieCell 的高度,但我想从 DropDownTable 中选择选项。

我该怎么办。

我尝试了 bringSubviewToFront,并在单击 Button 时禁用了 baseTableView

但没有帮助。

有没有其他方法可以完成任务。

感谢您的帮助。

这张图片会给出详细的想法。

enter image description here

我无法选择选项“A”、“B”、“C”,因为它们超出了单元格的边界。

提前致谢。

最佳答案

您只需要按如下方式调整单击按钮的单元格的大小:

    -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
CGRect rect = cell.frame;
rect.size.height = 150.0;
ht = 150.0; // declared previously. you may check in the attached project
selected = indexPath.row;
[cell setFrame:rect];
[tableView beginUpdates];
[tableView endUpdates];
}

我刚刚向您介绍了如何调整单元格的大小。这里我取了一个静态高度(150.0)。取而代之的是,您必须提供在 UIButton 单击时下拉的内部 tableView 的高度。

您可以找到动态更改单元格高度的演示项目here .

希望对您有所帮助。

关于ios - UITableView 优于 UITableViewCell didSelectMethod,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27740782/

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