UIListContentConfiguration
UIListContentConfiguration represents the content of one row in a list: primary text, secondary text, and an image on the left.
It is only data. It appears on screen once written to a cell's contentConfiguration, and the cell stores a copy:
/** @param {UICollectionViewListCell} cell */
function fill(cell) {
const content = cell.defaultContentConfiguration();
content.text = 'First';
cell.contentConfiguration = content;
content.text = 'Second';
}Effect: calling fill(cell) on a cell makes it show "First". Changes made after writing to the cell affect the app's own copy; the copy in the cell does not change. To make it show "Second", assign it again. Reading cell.contentConfiguration also returns a copy, and changing that copy does not affect the cell either.
Inheritance: EventTarget → NSObject → UIListContentConfiguration
Constructor
It cannot be created with new; new UIListContentConfiguration() throws TypeError. Get one from a cell's defaultContentConfiguration(), or use one of the three static methods below.
Static methods
UIListContentConfiguration.cellConfiguration()
A style with one line of primary text.
UIListContentConfiguration.subtitleCellConfiguration()
A style with a line of secondary text below the primary text.
UIListContentConfiguration.valueCellConfiguration()
A style with primary text on the left and secondary text on the right.
How the three styles look on screen is not verified in the simulator; their meanings come from Apple's documentation.
Instance properties
| Property | Description |
|---|---|
text | Primary text |
secondaryText | Secondary text |
image | Image to the left of the text |
Corresponding iOS API
| ObjC | JS |
|---|---|
[UIListContentConfiguration cellConfiguration] | UIListContentConfiguration.cellConfiguration() |
content.text = @"x" | content.text = 'x' |
content.image = image | content.image = image |