Link storyboard with viewcontroller without using the drag and drop

0

Is there a way to link a storyboard element with a variable using code, without having to use the drag and drop from the storyboard to the controller?

    
asked by w33haa 07.11.2017 в 23:05
source

1 answer

0

You can create the outlet with code, for example: @IBOutlet weak var myButton: UIButton!

Then then you have to go to the storyboard and connect them. The fastest way is to go to the view where you have to create it. In the view controller you go to the Connections Inspector and you will see the reference to myButton without connecting and you connect it to the button you have designed, because the system is not a fortune-teller. In this way you do not have to use the Edit Assistant that divides the two screens or use the drag and drop and it is much faster when you have several properties.

    
answered by 24.12.2017 в 12:55