Skip to content

Instantly share code, notes, and snippets.

@hemant3370
Created March 4, 2017 12:31
Show Gist options
  • Save hemant3370/5469ff643f7cc73177372af2b5fd7059 to your computer and use it in GitHub Desktop.
Save hemant3370/5469ff643f7cc73177372af2b5fd7059 to your computer and use it in GitHub Desktop.
collectionview cell in popup
let alertController = UIAlertController(title:"" , message: "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", preferredStyle: UIAlertControllerStyle.actionSheet)
let view = (collectionView.cellForItem(at: indexPath)?.contentView)!.copyView()
alertController.view.addSubview(view)
let cancelAction = UIAlertAction(title: "Done", style: .cancel, handler: {(alert: UIAlertAction!) in
collectionView.reloadData()
})
alertController.addAction(cancelAction)
alertController.popoverPresentationController?.sourceView = collectionView.cellForItem(at: indexPath)
alertController.popoverPresentationController?.sourceRect = (collectionView.cellForItem(at: indexPath)?.bounds)!
DispatchQueue.main.async {
self.present(alertController, animated: true, completion:{
view.frame.size = alertController.view.frame.size
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment