Using custom UITableViewCell, I\'m trying to change the height of tableViewCell\'s delete button. I\'ve tried all the solutions available here on SO.
Everyone has me
Same code but works with Swift 5 and iOS 12+
func tableView(_ tableView: UITableView, willBeginEditingRowAt indexPath: IndexPath) {
for subview in tableView.subviews {
if NSStringFromClass(type(of: subview)) == "UISwipeActionPullView",
let button = subview.subviews.first,
NSStringFromClass(type(of: button)) == "UISwipeActionStandardButton" {
button.backgroundColor = .red
button.layer.cornerRadius = 8
button.layer.masksToBounds = true
(button as? UIButton)?.contentHorizontalAlignment = .center
(button as? UIButton)?.contentVerticalAlignment = .center
(button as? UIButton)?.titleEdgeInsets = UIEdgeInsets(top: 6, left: 0, bottom: 0, right: 0)
button.superview?.backgroundColor = UIColor(white: 0.97, alpha: 1)
button.superview?.layoutIfNeeded()
}
}
}