Home > Articles > Programming > General Programming/Other Languages

  • Print
  • + Share This
This chapter is from the book


UIViews and their underlying layers provide the onscreen components your users see. Touch input lets users interact directly with views via the UITouch class and gesture recognizers. As this chapter has shown, even in their most basic form, touch-based interfaces offer easy-to-implement flexibility and power. You discovered how to move views around the screen and how to bound that movement. You read about testing touches to see whether views should or should not respond to them. You saw how to “paint” on a view and how to attach recognizers to views to interpret and respond to gestures. Here’s a collection of thoughts about the recipes in this chapter that you might want to ponder before moving on:

  • Be concrete. iOS devices have perfectly good touch screens. Why not let your users drag items around the screen or trace lines with their fingers? It adds to the reality and the platform’s interactive nature.
  • Users typically have five fingers per hand. iPads, in particular, offer a lot of screen real estate. Don’t limit yourself to a one-finger interface when it makes sense to expand your interaction into Multi-Touch territory, screen space allowing.
  • A solid grounding in Quartz graphics and Core Animation will be your friend. Using drawRect:, you can build any kind of custom UIView presentation you want, including text, Bezier curves, scribbles, and so forth.
  • If Cocoa Touch doesn’t provide the kind of specialized gesture recognizer you’re looking for, write your own. It’s not that hard, although it helps to be as thorough as possible when considering the states your custom recognizer might pass through.
  • Use Multi-Touch whenever possible, especially when you can expand your application to invite more than one user to touch the screen at a time. Don’t limit yourself to one-person, one-touch interactions when a little extra programming will open doors of opportunity for multiuser use.
  • Explore! This chapter only touches lightly on the ways you can use direct manipulation in your applications. Use this material as a jumping-off point to explore the full vocabulary of the UITouch class.
  • + Share This
  • 🔖 Save To Your Account