【问题标题】:Change the height of UITableViewCells when using static cells in Storyboards在 Storyboard 中使用静态单元格时更改 UITableViewCells 的高度
【发布时间】:2012-11-17 04:41:00
【问题描述】:

Storyboards 中使用静态单元格时是否可以调整UITableViewCellsUITableView 部分的大小?

我希望某些单元格比其他单元格更短,就像联系人应用程序具有更短的单元格一样,以便为图片腾出空间。我正在尝试使用情节提要中的静态单元而不是编程方式来做到这一点。

【问题讨论】:

    标签: iphone ios uikit storyboard


    【解决方案1】:

    在您的表格视图控制器中,实现以下方法:

    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
        if (indexPath.section == 0) {
            if (indexPath.row == 0) {
                // The first cell
                return 25.0;
            else if (indexPath.row == 1) {
                return 44.0;
            }
        }
        // Default
        return 30.0;
    }
    

    【讨论】:

    • 这对您的问题有帮助吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-31
    相关资源
    最近更新 更多