1

有谁知道Delete按钮出现时调整子视图(IE UILabelView)大小的任何方法。

可能有两种方法:

1.当按钮出现在UITableViewCell中时捕获一个通知,如果有的话。 2.告诉框架自动重新排列它。

4

1 回答 1

7

在你的 UITableViewCell 类的 .m 文件中使用 layoutSubviews。每次调整单元格大小、删除按钮出现/消失等时都会调用它:

- (void) layoutSubviews {

    [super layoutSubviews];


    frame = self.contentView.bounds; ///this is the availalbe space for the cell
    ///it's automatically adjusted when the delte button appears
    ///so use it to resize all of your interface elements
}

您还可以if (self.editing) {在 layoutSubviews 内部使用以获得更多控制。

于 2009-12-18T17:31:33.567 回答