How to work on the View added to the appearance of the ViewController in storyboards?

I have created a registration form where the user can select their Gender. When I click the Gender button, I need to show a custom view. I want to use the Storyboard to create a view, but I cannot work on it as I cannot see it without adding it to the main View Viewer. See image below. I want to keep this view separate from the main View Controller and I will add this view programmatically when the user taps the gender button.

enter image description here


source to share

2 answers

You cannot add UIView to canvas in storyboard, it must be contained in UIViewController.

Your options:

1) Create a xib file for your UIView subclass and create it there. Then import it by calling -loadNibNamed: on the main bundle.

2) Make a programmatic layout programmatically inside your UIView subclass.

3) Add the container view to your main VC and use the view controller it generates to design your gender view. Then you can start with it hidden and show it when you click on the gender button.



• Place it as a sub
• Design • Place it back outside the view controller.



All Articles