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 Text Dynamic with UITextField

Most apps have more than just buttons and labels; usually we need the user to enter some data, like a tweet or email address. UITextField is the basic view we use to grab string-type input, and now we’re going to add one to our little box app. It will let the user pick the UIColor of our boxes using simple commands like “red” and “blue.” Let’s get started.

First we need to add the field to the view hierarchy. UITextField puts many configuration options at our disposal, from fonts to the look of the Return key. We won’t be using all of its properties today, but you can consult Apple’s documentation on the class for more information.[9] Our field should be added in app_delegaterb like so:

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