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

Re: NSBezierPath


  • Subject: Re: NSBezierPath
  • From: "Louis C. Sacha" <email@hidden>
  • Date: Mon, 1 Dec 2003 03:49:26 -0800

Hello...

I would add to the previous comments by James Chen about locking the focus before drawing, that this depends on how your drawNeedleForError: method is being called. If you only call this method from inside GaugeView's drawRect: method, then the focus has already been taken care of for you automatically. If you are calling this method from outside the GaugeView's drawRect: method or any other object is calling this method on your gaugeView instance, then you definitely need to do as he said and lock/unlock focus properly.

Also, you might want to change the

gaugeRect = [gaugeView frame];

call to

gaugeRect = [gaugeView bounds];

A view's frame represents its position and size in it's superview, a view's bounds represents the rect used internally for drawing its content.



Anyway, the following code isn't working (at all). This is currently just a test method that should simply draw a line from the bottom left corner to the top right corner. gaugeView is declared in my .h file and is linked to an NSQuickDrawView in IB. I have verified that the output of the NSLog is appropriate. Any help would be appreciated; TIA!


Finally, you might want to verify that you have added your gaugeView to the NIB file correctly in Interface Builder. I may be misunderstanding what you are trying to say above, but it doesn't sound right to me. If your GaugeView class is a subclass of NSView, then you need to drag an NSView to your window (it looks like a shaded rectangle, which I believe says "Custom View" on it). Then either drag the GaugeView.h file onto Interface Builder, or choose the "Classes" tab in the shelf that displays the objects in the nib file and then select "Read Files" from the "Classes" menu in the main menubar and choose your GaugeView.h file. After that, click on the custom View that you dragged to the window earlier and then choose the "Custom Class" tab on the Inspector panel. Select GaugeView in the list of classes displayed. You'll also need to make whatever connections to the gaugeView from the objects that you need to send commands from.


Hope that helps,

Louis
_______________________________________________
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.

  • Follow-Ups:
    • Re: NSBezierPath
      • From: Daniel Todd Currie <email@hidden>
  • Prev by Date: Re: reading keys from a plist file
  • Next by Date: Re: reading keys from a plist file
  • Previous by thread: Re: NSBezierPath
  • Next by thread: Re: NSBezierPath
  • Index(es):
    • Date
    • Thread