0

我一直在網上查找,試圖找出UICollectionViewCell的視圖層次結構。在UICollectionViewCells中的contentView上方或下方顯示selectedBackGroundView?

我知道它有一個contentView a selectedBackgroundViewbackgroundView。 從我所瞭解的backgroundView就在後面。但是在UICollectionViewCell的情況下selectedBackgroundViewcontentView之後或之前。

對於UITableViewCell,這個視圖層次結構的順序也是一樣的嗎?

回答

2

selectedBackgroundView落後於contentView。從Apple文檔:

當選中單元格時,此視圖分層放置在backgroundView和contentView後面。

+0

謝謝!並且內部實現是否將'selectedbackgroundview'添加到'UICollectionCellView'的層次結構中?或者你需要自己添加嗎?提前致謝。 –

+1

是的,我相信iOS會照顧你,因爲你只需要設置單元格的屬性。 此外,如果答案有幫助,您能否將其標記爲「正確」? – Fahim

相關問題