Skip to content
edwardinubuntu edited this page Dec 15, 2010 · 9 revisions

Welcome to the Painter wiki!

Introduction

The Painter app turns the iPhone screen into a virtual canvas. The user paints by dragging one or more fingers across the screen. (OK!)
The line color and thickness can be set by touching the info button in the lower-right corner of the screen. (OK!)
The control panel includes a slider for line width and red, green and blue sliders for line color. (OK!)
As the Line Width slider is moved from left to right, the width of the line increases. (OK!)
At the bottom of the screen, two buttons allow the user to turn a finger into an eraser or clear the screen entirely. (OK!)
At any point while painting, the user can shake the iPhone to clear the entire drawing from the screen. (OK!)

##Build Requirements:
SDK iOS 4.0 above with Xcode

##Runtime Requirements: SDK iOS 4.0 above with iOS Simulator

##Packaging List

  • Main View Controller: The main page for the painter.
  • Squiggle: An object help with drawing.
  • Main View: Then main view for drawing event, handle the main drawing.
  • Flipside View Controller: The view for setting the color and line width.

Changes from previous versions

  • Version 1.0
    • Color drawing fine, fixed issues passing attributes' value.

The code is reference from the book. Copyright (C) 1992-2009 by Deitel & Associates, Inc. All rights reserved

Wrap-Up

From this Painter app, we can learn about how to custom UIViewController and FlipsideViewController. How to handle all three types of touch events, along with motion events generated when the user shakes the iPhone. Also can see how to store primitives and structures in collections user the NSValue class, and how to selectively redraw a UIView to optimize the app's performance.

Clone this wiki locally