• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: / bar graphics /
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >/ bar graphics / (From: Luis E! <email@hidden>)

  • Prev by Date: CFStream and Cocoa stream
  • Next by Date: Re: Sleeping and waking NSThread
  • Previous by thread: Re: / bar graphics /
  • Next by thread: Re: Sleeping and waking NSThread
  • Index(es):
    • Date
    • Thread