O'Reilly logo

iOS 8 SDK Development, 2nd Edition by Janie Clayton, Chris Adamson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Connecting User Interface to Code

It’s great that our UI handles resizing and orientation changes, but it still doesn’t, y’know, do anything yet.

And that raises an interesting question: how do we get the 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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required