Linked Questions

Popular Questions

How to find index Path for a selected Collection View Cell?

Asked by At

How to find index Path for a selected Collection View Cell without using didSelectItemAtIndexPath and prepareForSegue?

I am using this indexPath within AlertViewController. I dont know how to get this indexPath in AlertView Controller.

//Edit Selected Category
        let alertController = UIAlertController(title: "Alert", message: "Rename your ", preferredStyle: .alert)
        let actionOK = UIAlertAction(title: "OK", style: .default)

        alertController.addTextField(configurationHandler: {(textField: UITextField) -> Void in

            if let iP: IndexPath = self.collCategory.indexPath(for: CategoryCollectionCell) {

                print("IP \(iP)")
            }

        })

        alertController.addAction(actionOK)
        self.present(alertController, animated: true, completion: nil)

Related Questions