• 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: How to draw a rectangle in a NSView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to draw a rectangle in a NSView


  • Subject: Re: How to draw a rectangle in a NSView
  • From: Gregory Weston <email@hidden>
  • Date: Sat, 25 Sep 2004 11:15:42 -0400

On Sep 25, 2004, at 9:30 AM, Peter Karlsson wrote:

I wonder if someone can show me how to draw a rectangle in a NSView? This
is very new to me so I need some help to get started.


I found this example...

[[NSColor blueColor] set];
[[NSBezierPath bezierPathWithRect:NSMakeRect(10, 10, 50, 60)] stroke];

...but I can not figure out where I select the view to draw on. I do not
want it to autodraw. I want to place the code in an action.

Depending on what you're really trying to accomplish, it may be most appropriate to simply invalidate the view in the action and then do the drawing in drawRect: as normal. Otherwise, check out lockFocus in NSView.


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Multiple Inheritence (Was: Is _objc_flush_caches_(Class) necessary to swizzle methods?)
  • Next by Date: Dragging an NSImage from an NSTextView?
  • Previous by thread: Re: How to draw a rectangle in a NSView
  • Next by thread: How to do a progress window the "right way"?
  • Index(es):
    • Date
    • Thread