O'Reilly logo

RubyMotion by Clay Allsopp

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

Adding a New UIViewController

As the name suggests, UIViewControllers are objects that control a view. The UIViewController object stores the UIView it manages inside the view attribute. However, we generally don’t use addSubview: to add this particular view to the screen; instead, various methods will often take the entire UIViewController object and adjust the view as necessary before adding it to a hierarchy.

Let’s get started with a small project to see how UIViewController works, and you’ll see what I mean. We’ll create an app showing different ways to explore colors, specifically, motion create ColorViewer.

First we make the ./app/controllers directory (mkdir ./app/controllers). This is where we’ll keep all of our controller classes. ...

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