• 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: lockFocus error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lockFocus error


  • Subject: Re: lockFocus error
  • From: Graham Cox <email@hidden>
  • Date: Tue, 21 Oct 2008 11:52:31 +1100


On 21 Oct 2008, at 10:48 am, DKJ wrote:

On 20 Oct, 2008, at 16:32, Graham Cox wrote:
What would you expect it to do?


Suppose I wanted it to draw lines in response to user input. Would I put NSBezierPath methods in drawRect: and expose the relevant properties in the subclass?


To draw lines, you can use NSBezierPath as a storage container in your view subclass. You need to:

1. Override -mouseDown: and -mouseDragged: to respond to the mouse
2. Accumulate lines in the NSBezierPath using its -lineToPoint: method for each new mouse point.
3. Mark the view for update using -setNeedsDisplay: or - setNeedsDisplayInRect:
4. Draw the path in -drawRect:


The NSBezierPath object would be owned by your view.

Depending on what you want, you could either clear the path using - removeAllPoints on the mouseDown, or maybe create a new path and add it to a list.

hth,

Graham
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >lockFocus error (From: DKJ <email@hidden>)
 >Re: lockFocus error (From: Nick Zitzmann <email@hidden>)
 >Re: lockFocus error (From: DKJ <email@hidden>)
 >Re: lockFocus error (From: Nick Zitzmann <email@hidden>)
 >Re: lockFocus error (From: DKJ <email@hidden>)
 >Re: lockFocus error (From: Graham Cox <email@hidden>)
 >Re: lockFocus error (From: DKJ <email@hidden>)

  • Prev by Date: @property and HeaderDoc
  • Next by Date: Using Core Animation to animate view properties?
  • Previous by thread: Re: lockFocus error
  • Next by thread: Re: lockFocus error
  • Index(es):
    • Date
    • Thread