-
Modern cell configuration
Discover new techniques for configuring collection view and table view cells to quickly build dynamic interfaces in your app. Explore configuration types you can use to easily populate cells with content and apply common styles. Take advantage of powerful APIs to customize the appearance of cells for different states. Find out about patterns and best practices that simplify your code, eliminate bugs, and improve performance.
Recursos
Vídeos relacionados
WWDC22
WWDC21
WWDC20
-
Buscar neste vídeo...
-
-
1:31 - Configuring a UITableViewCell
cell.imageView?.image = UIImage(systemName: "star") cell.textLabel?.text = "Hello WWDC!" -
1:59 - Configuring a UITableViewCell Using a Content Configuration
var content = cell.defaultContentConfiguration() content.image = UIImage(systemName: "star") content.text = "Hello WWDC!" cell.contentConfiguration = content -
13:10 - Updating Configurations
let updatedConfiguration = configuration.updated(for: state) -
16:33 - Customizing Appearance for Different States
override func updateConfiguration(using state: UICellConfigurationState) { var content = self.defaultContentConfiguration().updated(for: state) content.image = self.item.icon content.text = self.item.title if state.isHighlighted || state.isSelected { content.imageProperties.tintColor = .white content.textProperties.color = .white } self.contentConfiguration = content } -
19:45 - Default Configurations
var background = UIBackgroundConfiguration.listSidebarCell() var content = UIListContentConfiguration.sidebarCell() -
26:23 - Creating a List Content View
var content = UIListContentConfiguration.cell() // Set up the content configuration as desired... let contentView = UIListContentView(configuration: content)
-