How to get indexPath
of collectionViewCell
on Button click and Button is in Out sided from collectionviewCell
. I am trying with sender
and Superview
. But it is not working.
@IBAction func btnCancel(_ sender: Any) {
if let cell = (sender as AnyObject).superview??.superview?.superview?.superview?.superview?.superview as? ImageShowinPopUpCell {
let indexPath = collectionview.indexPath(for: cell)
deleteDublicateImage(id: isNilValue(assignValue: dbImageDataModel![(indexPath?.row)!].id))
collectionview.reloadData()
if dbImageDataModel.count == 0
{
dismiss(animated: true, completion: nil)
}
}
}