Ok, I've encountered a strange behaviour (bug) by UITableViewRowAction
. I'm trying to add an icon to a swipe left action.
Bellow is my code for setting an icon inside the table view delegate's tableView(_:trailingSwipeActionsConfigurationForRowAt:)
method (action is an instance of UIContextualAction
):
action.image = UIGraphicsImageRenderer(size: Constants.swipeActionImageSize)
.image(actions: { _ in
Constants.messageReplyIcon.draw(in: CGRect(origin: .zero,
size: Constants.swipeActionImageSize))
})
I'm using this solution since need to resize the image a little bit. This works fine on iOS 13 but on iOS 12 (actually, running on iOS 12.2), it renders the image as a white circle. Bellow, you can see screenshots of the icon on iOS 13 simulator and on iOS 12.2 simulator one after another.
iOS 13
iOS 12.2
Note that this happens even when I simply set the image, without doing all that fancy stuff for resizing.
However, when I look at the image in UI Debugger while sill on iOS 12, I see the following:
I suspect, the UIContextualAction
applies some tint color to the icon on iOS 12, but can't figure out why, and because of that, can't find a solution.
Maybe, you've encountered something like this, or have ideas about the reasons? Thanks in advance.