i have made a grid of images and in order to show its selection i drew border for the image when selected. but the problem is when i select some image at the top and scroll down
This code is in Swift 3:
if self.selectedItemIndexPath != nil && indexPath.compare(self.selectedItemIndexPath) == .orderedSame {
cell.imageView!.layer.borderColor = UIColor.red.cgColor
cell.imageView!.layer.borderWidth = 4.0
} else {
cell.imageView!.layer.borderColor = nil
cell.imageView!.layer.borderWidth = 0.0
}
return cell