Re: / bar graphics /
Re: / bar graphics /
- Subject: Re: / bar graphics /
- From: Shawn Erickson <email@hidden>
- Date: Mon, 21 Jun 2004 10:33:28 -0700
On Jun 21, 2004, at 10:01 AM, Luis E! wrote:
I need to do a bar graphic based on an array of data.
I saw that you can draw things in a NSView, but you
have to specify the drawing in only one method:
drawRect:.
I changed to OpenGL but it seems it's the same: you
can only draw things inside the drawRect: method.
The drawing system in Cocoa and Quartz (even OpenGL) have a well
defined way of setting up the drawing environment for a window
(context) so you can do your drawing. Trying to go outside of that is
causing yourself more work if not making things impossible to do.
I think you are making things hard on yourself some how by holding onto
a fix way that a thing must be done... step back and think about what
you need to do and how the frameworks you are working with work.
Have you looked at any of the example code provided on how to draw
things using custom views? Look under /Developer/Examples/AppKit/ for
them... I would review CircleView, DotView, Wrom, BezierPathLab, etc.
I need to have this array as an input parameter and I
don't know what to do... any ideas? Is there a
different/easier way to draw graphics than the ones
named above?
As an input parameter to what... to drawRect? You want this information
available in your drawRect method?
If so set up a reference to the source of the data in an instance
variable of your custom view class (at initialization time possible or
by providing set methods). Then in the drawRect method you can access
that data to do the drawing needed. Is this the issue you are hitting?
-Shawn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.