The best way to implement drawing features like Keynote

Posted by Shamseddine on Stack Overflow See other posts from Stack Overflow or by Shamseddine
Published on 2010-05-10T07:30:23Z Indexed on 2010/05/10 7:34 UTC
Read the original article Hit count: 296

Filed under:
|
|
|
|

Hi all,

I'm trying to make a little iPad tool's for drawing simple geometrical objects (rect, rounded rect, ellipse, star, ...). My goal is to make something very close to Keynote (drawing feature), i.e. let the user add a rect (for instance), resizing it and moving it. I want too the user can select many objects and move them together.

I've thought about at least 3 differents ways to do that :

  • Extends UIView for each object type, a class for Rect, another for Ellipse, ... With custom drawing method. Then add this view as subview of the global view.
  • Extends CALayer for each object type, a class for Rect, another for Ellipse, ... With custom drawing method. Then add this layer as sublayer of the global view layer's.
  • Extends NSObject for each object type, a class for Rect, another for Ellipse, ... With just a drawing method which will get as argument a CGContext and a Rect and draw directly the form in it. Those methods will be called by the drawing method of the global view.

I'm aware that the two first ways come with functions to detect touch on each object, to add easily shadows,... but I'm afraid that they are a little too heavy ? That's why I thought about the last way, which it seems to be straight forward.

Which way will be the more efficient ??? Or maybe I didn't thought another way ?

Any help will be appreciated ;-)

Thanks.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about drawing