当前位置: 动力学知识库 > 问答 > 编程问答 >

ios - What are pros / cons to add UIView to cell vs cell.contentView?

问题描述:

I have a UITableViewCell. How should I add a subview to it? I have seen many example to add subview to the contentView, but why not directly to the cell?

网友答案:

You can do it, but If you want to customize cells by adding custom view, you should add them to the contentView in order to get them animated along the table animations

网友答案:

When you add a custom view to contentView or assigning to contentView handles framing resizing part ,animation part and when editing mode is ON (tableView.editing = YES;) tableview tries to operate with views of itself meaning contentView, accessoryView. So when you want to add something to the table view and let control be given to tableView go for contentView

分享给朋友:
您可能感兴趣的文章:
随机阅读: