Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show ViewController from XIB-file-Button - Swift

is there a way how to segue from a xib-file (custom TableViewCell) to another ViewController in the Main.storyboard.

There's no possibility to drag a segue, like within the main storyboard.

In the cell I've got a button, from where I want to change the view. How can I solve it?

Thanks!

like image 345
chrisby Avatar asked Feb 11 '23 14:02

chrisby


1 Answers

You can always instantiate a view controller from your Storyboard and present it on button tapped:

    let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let vc = storyboard.instantiateViewControllerWithIdentifier("ViewControllerID") as UIViewController
    self.presentViewController(vc, animated: true, completion: nil)
like image 168
juliensaad Avatar answered Mar 29 '23 15:03

juliensaad