• 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: Qustion about possibly bad advice in NSView documentation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Qustion about possibly bad advice in NSView documentation


  • Subject: Re: Qustion about possibly bad advice in NSView documentation
  • From: Dominik Pich <email@hidden>
  • Date: Tue, 25 Sep 2007 16:39:53 +0200

You can wrap primitves using the NSValue class and pass it that way as an object.

Regards,
Dominik

On 25.09.2007, at 16:08, Erik Buck wrote:

The conceptual documentation for NSView contains the following note:
http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaViewsGuide/SubclassingNSView/chapter_5_section_3.html


"Note: The implementation of the NSView class before Mac OS X v10.4.3 could discard any rectangles marked as needing display within a subclass's implementation of drawRect:. For maximum compatibility, when marking areas as requiring display from within the drawRect: method it is best to call the view's setNeedsDisplayInRect: method using the NSObject instance method performSelector:withObject:afterDelay:."

Um, isn't this supremely bad advice ? performSelector:withObject:afterDelay:. requires an _object_ argument. How exactly is an NSRect structure going to be passed as the argument to performSelector:withObject:afterDelay:?

I think the note should have stated, "don't call - setNeedsDisplayInRect: from within an implementation of -drawRect: because some versions of Mac OS X ignore changes to invalid areas from within -drawRect." Even more advice would be "limit the code within an implementation of -drawRect: to code that actually draws. Any other code such as application logic to determine what should be drawn is best implemented elsewhere because -drawRect: will be called automatically by Cocoa whenever a view needs to be drawn, and you may not be able to predict all of those times."

_______________________________________________

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

_______________________________________________

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


  • Follow-Ups:
    • Re: Qustion about possibly bad advice in NSView documentation
      • From: Erik Buck <email@hidden>
References: 
 >Qustion about possibly bad advice in NSView documentation (From: Erik Buck <email@hidden>)

  • Prev by Date: Qustion about possibly bad advice in NSView documentation
  • Next by Date: Re: Qustion about possibly bad advice in NSView documentation
  • Previous by thread: Qustion about possibly bad advice in NSView documentation
  • Next by thread: Re: Qustion about possibly bad advice in NSView documentation
  • Index(es):
    • Date
    • Thread