Created
March 4, 2017 12:31
-
-
Save hemant3370/5469ff643f7cc73177372af2b5fd7059 to your computer and use it in GitHub Desktop.
collectionview cell in popup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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