UITableViewCell的層級結構

UITableViewCell中的contentView、backgroundView、selectedBackgroundView、multipleSelectionBackgroundView

UITableViewCell 層級結構bash

  1. UITableViewCell
Default is nil for cells in UITableViewStylePlain, and non-nil for UITableViewStyleGrouped. 
 The 'backgroundView' will be added as a subview behind all other views.
複製代碼
  1. backgroundView
Default is nil for cells in UITableViewStylePlain, and non-nil for UITableViewStyleGrouped. 
The 'selectedBackgroundView' will be added as a subview directly above the backgroundView if not nil, or behind all other views. 
It is added as a subview only when the cell is selected. 
Calling -setSelected:animated: will cause the 'selectedBackgroundView' to animate in and out with an alpha fade.
複製代碼
  1. selectedBackgroundView (multipleSelectionBackgroundView)]
If you want to customize cells by simply adding additional views, 
you should add them to the content view so they will be positioned appropriately as the cell transitions into and out of editing mode.
複製代碼
  1. contentView
selectedBackgroundView只有在用戶點擊cell的時候纔會被cell看成子類加入,層級在backgroundView(若是它存在)之上,其餘全部控件之下。

multipleSelectionBackgroundView的層級是在contentView之下,selectedBackgroundView之上。

複製代碼

相關文章app

相關文章
相關標籤/搜索