[Question] How do I use a button on this card to launch a new ViewController>
Proudspark opened this issue · 1 comments
Proudspark commented
New Issue Checklist
- I read the documentation.
- I searched for existing GitHub issues.
- I searched Google for a solution to my issue if applicable.
Question
A method I'm using on other ViewControllers no longer works when I attempt to use the method from the CardCell class:
@IBAction func Show_Me_Pressed(_ sender: Any) {
let storyboard = UIStoryboard(name: "main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "GameViewController") as UIViewController
self.present(vc, animated: true, completion: nil)
}
returns error: Value of type 'CardCell' has no member 'present'
How can I open a ViewController over the Cards ViewController using a button on the ExampleCell.xib?
Thanks, any pointers greatly appreciated.
JoniVR commented
CardCell
subclasses from UICollectionViewCell
, so just like you would with a UICollectionViewCell
. I would create either a delegate or closure for callback in this case (same way you would with UICollectionViewCell
)