Chapter 9. Saving Data and Creating a Secret Button

In This Chapter

  • Setting and accessing user preferences

  • Saving data in user preferences

  • Disabling and enabling text fields

  • Responding to user touches

In putting together a great iPhone application, a big part of the whole process involves getting your application to work well from the user interface perspective. Your potential user should be able to scroll the keyboard, work with text fields, enter stuff, delete stuff, admire your fashion sense when it comes to images and background color, and generally have a grand-old time exploring the corners of your app.

Interfaces are important — so important, in fact, that most of the chapters so far in this part deal explicitly with how to set up a user-friendly interface — but interfaces are not the only things in the iPhone app universe. For your application to function as an application, it has to do application-like stuff. For example, it has to be able to save data entered by a user for the next time he or she fires up that app. In this chapter, I tackle how to get your app to save data entered by the user. Again, I'm going to trot out my ReturnMeTo application as a means of imparting this little lesson in data saving.

Wait! That's not all! It occurred to me while I was showing people my handy ReturnMeTo application that whoever found my iPhone could accidently enter a number in the text field — corrupting the crime scene, as it were — and then wouldn't know where to call me. So I decided ...

Get iPhone® Application Development For Dummies®, 2nd Edition 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.