简体   繁体   English

按钮显示在自定义UITableViewCell中的单元格下

[英]Button Displays Under Cells in Custom UITableViewCell

I have an app that uses a custom UITableViewCell to display detail information after a user clicks on a given row in a table. 我有一个应用程序,它使用自定义UITableViewCell在用户单击表中的给定行后显示详细信息。 I can't seem to figure out why the "Reply" button located in the cell is inactive and appears behind the table itself. 我似乎无法弄清楚为什么位于单元格中的“答复”按钮处于非活动状态并出现在表格本身的后面。 I can't click on it, select it, or do anything. 我无法单击它,选择它或执行任何操作。 I used Interface Builder to add the button rather than programmatically add it. 我使用Interface Builder来添加按钮,而不是以编程方式添加它。

I've tried changing a number of things including the cell's class and File's Owner, but can't seem to get the button to be active and working. 我曾尝试更改许多内容,包括单元格的类和File的Owner,但似乎无法使按钮处于活动和工作状态。 I think the button is linked up properly with a connection to a method in the code. 我认为按钮与代码中方法的连接已正确链接。

表格下的UIButton

Here's a minimal, complete example of the code: 这是一个最小的完整代码示例:

https://www.dropbox.com/s/atcof58ciqbaojr/CustomCell.zip https://www.dropbox.com/s/atcof58ciqbaojr/CustomCell.zip

Apparently I needed to tell the table view how high the cell was. 显然,我需要告诉表格视图单元格的高度。 This is what fixed it: 这是固定的原因:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
{
    return 157.0;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM