문제

What's the point of this contentView property? I mean: Why aren't all the subviews just added to self?

Let me get that right: Every cell is a view (UITabvleViewCell is a UIView subclass). And this fat view has another fat view with same bounds sitting on top of it, called contentView. That contentView then carries all those other subviews.

Now why didn't they save that extra chunk of memory? Is there any genius logic behind this decision? Would love to understand the reason for this.

도움이 되었습니까?

해결책

The content view does not always have the same bounds as the cell. For instance, when entering editing mode, the delete button slides the content view to the right, resizing it in the process.

From A Closer Look at Table View Cells

Figure 5-1 Parts of a table view cell:

enter image description here


Figure 5-2 Parts of a table-view cell in editing mode:

enter image description here

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top