Connecting user interfaces with your code
Putting a new element inside your interface files is extremely simple. You just have to select one of the available objects from the objects library and drag and drop it inside the interface editor.
For example, let's say you want to create the user interface for a subclass of UIViewController
called SignInViewController
that implements user sign-in. The first step is to drag and drop a view controller object inside the Storyboard interface editor. Then, select the newly added view controller, and from the Identity inspector (third button on the right-hand side panel), update the information of the custom class area, specifying the name SignInViewController
as the class name. The view controller you see inside the interface editor is now an instance of this class, and you can draw and connect the necessary elements and methods.
In the SignInViewController
class, you defined the username and password text fields and the signIn
method. The two text fields...