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

Making GET Requests and SearchController

The first controller the user interacts with is the SearchController. Here, the user can enter a hexadecimal color code like #3B5998 and tap a button to see detailed information about that color. The only edge case we need to worry about is if the Colr database doesn’t contain that color; in that case, we’ll alert the user accordingly.

Setting Up the UI

How does the user enter text? We’re going reach back all the way to Making Text Dynamic with UITextField and use the venerable UITextField. We’ll use it along with a UIButton to actually trigger the search.

Let’s start setting up these elements. Open search_controllerrb and fill in viewDidLoad with our new subviews.

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