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, ...

Get Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.