I am using tableview cell Reorder control in my application and it works well till iOS 14 but not working on iOS 15. In iOS 15 Reorder Control’s color is not changed.
Following is code what I used. So how can I change Reorder Control’s color in iOS 15.
private var myReorderImage : UIImage? = nil;
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
for subViewA in cell.subviews {
if (subViewA.classForCoder.description() == "UITableViewCellReorderControl") {
for subViewB in subViewA.subviews {
if (subViewB.isKind(of: UIImageView.classForCoder())) {
let imageView = subViewB as! UIImageView;
if (myReorderImage == nil) {
let myImage = imageView.image;
myReorderImage = myImage?.withRenderingMode(UIImageRenderingMode.alwaysTemplate);
}
imageView.image = myReorderImage;
imageView.tintColor = UIColor.red;
break;
}
}
break;
}
}
}
2
Answers
In iOS 15, I tried to customise Reorder control's icon but failed to do that. So I simply remove UIImageview object from Reorder control. And create my own image view object programmatically and set image to that imageView. And after that add that imageView as addSubview into Reorder control. And it solved my problem.
Follow sharing code so it help to others who face same issue.
This is the objective code solution created based on the previous answer with some minor changes: