Hi,
I'm using a UICollectionViewCell in my project and I can't wrap my head around why cell's UI state isn't changing when selected.
This is my code:
override func updateConfiguration(using state: UICellConfigurationState) {
super.updateConfiguration(using: state)
var background = UIBackgroundConfiguration.listGroupedCell().updated(for: state)
background.cornerRadius = 25
// Update background based on selection state
if state.isSelected {
background.backgroundColor = .systemBlue.withAlphaComponent(0.3)
background.strokeColor = UIColor.systemBlue
background.strokeWidth = 1.5
} else {
background.backgroundColor = isHoveredOver ? .hoverHighlightBackground : .background
background.strokeColor = UIColor.borderColor
background.strokeWidth = 1
}
backgroundConfiguration = background
}
The if block does get executed but it's not working for some reason. On the other hand, the else block works just fine, my cell's background is being highlighted when hovered over, the stroke is showing etc.
What am I missing here?
Thank you.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi,
I'm trying to code a kanban board (like Trello) with UICompositionalLayout, but I'm unable to create regular section headers. Instead section headers are overlapping the content cells.
Here is a link to the demo project: demo project
Thank you.