Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming
by Maurice Sharp, Erica Sadun, Rod Strougo
Adding the Editor Visual Elements
Any app that shows values probably needs to edit at least some of them; this is true of CarValet. To edit a car, you need to show and change values. UILabel can only display values. UITextField enables the user to edit text. Anything that can be changed to and from text can be edited, including strings, numbers, and dates. A good rule of thumb is that any text string or non-object value stringWithFormat: can create is editable with UITextField.
Like UILabel, UITextField uses the text attribute for what is displayed. You can use it to display a string—say, the current make of a car—as well as read whatever changes the user made. Text fields come with lots of handy behaviors, including support for keyboards, copying, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access