Making Connections

So, how do we get the Send Tweet button tap to do something? After all, we’ve been creating the user interface in the Main.storyboard file, but it doesn’t look like there’s any place in this editor to start writing code.

In iOS, we use Interface Builder connections to tie the user interface to our code. Using Xcode, we can create two kinds of connections:

  • An outlet connects a variable or property in code to an object in a storyboard. This lets us read and write the object’s properties, like reading the value of a slider or setting the initial contents of a text field.

  • An action connects an event generated by a storyboard object to a method in our code. This lets us respond to a button being tapped or a slider’s value changing. ...

Get iOS 9 SDK Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.