Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

8. Gestures and Touches > Recipe: Adding Persistence to Direct Manipulation Int...

Recipe: Adding Persistence to Direct Manipulation Interfaces

Persistence represents a key iOS design touch point. After users leave a program, Apple strongly recommends that, upon returning, they encounter a state that matches as closely to where they left off as possible. Even with new multitasking features, users should expect to resume their interactions where they left off. Adding persistence to a direct manipulation interface, in the simplest approach, involves storing a representation of the onscreen data when an application suspends or terminates and then restoring that state on startup.

Storing State

Every view knows its position because you can query its frame or center. This enables you to easily recover and store positions for each onscreen flower. The flower type (green, pink, or blue) is another matter. For each view to report its current flower, the DragView class must store that value, too. Adding a string instance variable enables the view to return the image name used. Extending the DragView interface lets you do that.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial