Hello. In my UITableViewController, I have a custom UITableViewCell. I have added an option to delete a specific row in the table. Based on the comments that I have found on-line, the following was added to the subclass of UITableViewCell:
override func willTransition(to state: UITableViewCellStateMask)
{
super.willTransition(to: state)
if (state == UITableViewCellStateMask.showingDeleteConfirmationMask)
{
for subview in self.subviews as [UIView]
{
// THIS IS WHERE THE WARNING IS SHOWN
if (subview is UITableViewCellEditingStyle )
{
let deleteBtn : UIImageView = UIImageView(frame: CGRect(x: 0,
y: 0,
width: 64,
height: 33))
deleteBtn.image = UIImage(named: "image.png")
subview.subviews[0].addSubview(deleteBtn)
}
}
}
}
Everything works just fine, however xCode shows a warning that "Cast from 'UIView' to unrelated type 'UITableViewCellEditingStyle' always fails". Is there another way to implement it?
Thanks a lot!