简体   繁体   English

无法在Interface Builder中更改UITableViewCell大小

[英]Can't change UITableViewCell size in Interface Builder

Does anyone have the same problem as I do? 有没有人和我一样有问题? ... I've upgraded to the iPhone SDK 3.2 and I am unable to resize UITableViewCell object in my XIB file (usually I've been just resizing the view but now the cell has the same size and there is just a grey are around) ... btw, I've tried to reinstall twice including one deep reinstall. ...我已经升级到iPhone SDK 3.2并且我无法在我的XIB文件中调整UITableViewCell对象的大小(通常我只是调整视图的大小,但现在单元格大小相同而且只有灰色的周围)...顺便说一句,我试图重新安装两次,包括一次深度重新安装。

Hey I had this same issue. 嘿,我有同样的问题。 This is old, so maybe you found a solution already, but for those who haven't... 这是旧的,所以也许你已经找到了解决方案,但对于那些没有...

Select the cell in IB, and bring up the size panel (by clicking to it or with command-3). 在IB中选择单元格,然后调出大小面板(通过单击它或使用命令-3)。 Under size & position, set to frame, and edit the height box there. 在尺寸和位置下,设置为框架,然后在那里编辑高度框。

Easy, huh. 很简单,呵呵。 Don't know how we missed this. 不知道我们是怎么错过这个的。

The tableviewcell size can be set by dragging the cell frame in the interface builder. 可以通过在界面构建器中拖动单元框架来设置tableviewcell大小。 Then implement then tableview delegate tableView heightForRowAtIndexPath for the particular cell you want to have a different height. 然后为您想要具有不同高度的特定单元格实现tableview委托tableView heightForRowAtIndexPath。

I have 3.2 installed and don't have that issue. 我安装了3.2并且没有这个问题。 Check that you are returning the correct cell height for heightForRowAtIndexPath . 检查您是否返回了heightForRowAtIndexPath的正确单元格高度。 So for a cell at section zero, row zero (that uses a custom UITableViewCell), use the height of the cell defined in the XIB: 因此,对于第0部分的第0行(使用自定义UITableViewCell)的单元格,请使用XIB中定义的单元格的高度:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(indexPath.section == 0 && indexPath.row == 0)
        return m_customCell.frame.size.height;
    else
        return 44;
}

The accepted answer (selecting the TableCell) and using the inspector did not work for me with XCODE 5. 接受的答案(选择TableCell)和使用检查器对XCODE 5不起作用。

This worked: - In interface builder, select the TABLE VIEW (NOT the TableViewCell). 这有效: - 在界面构建器中,选择TABLE VIEW(而不是TableViewCell)。 - Then in inspector (Size Inspector), notice at the top "Row Height". - 然后在检查员(尺寸检查员)中,注意顶部的“行高”。 Set that as desired. 根据需要设置。 - Also notice Section Height can be set here too! - 另请注意章节高度也可以在这里设置!

Final note, the table cell can definitely be drag/resized as well. 最后请注意,表格单元格也可以拖放/调整大小。

first tab (Attributes) -> subtab(Simulated User Interface Elements) -> Status Bar: set(Unspecified) . 第一个选项卡(属性) - >子选项卡(模拟用户界面元素) - >状态栏:设置(未指定)。 Worked for me 为我工作

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

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