On Jun 2, 2008, at 19:49, Michael Toy wrote:

what I find is that my initWithFrame method is not being called ... so i have two questions ...

my drawRect: IS being called, so I know my custom view is being instantiated. why is my init not being called? i thought i figured out the documentaiton enough to understand that the phrase "This method is the designated initializer for the NSView class. Returns an initialized object." meant that this was the only method i needed to write to have custom behavior at creation time.

forget that, is there another way to win?

thanks in advance, i am happy to accept pointers to the documentation i should have found.

If you designed your view in IB, so that it's in a nib file, initWithFrame is not necessarily called when your application runs. (initWithCoder may be called instead.) See:

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/SubclassingNSView/chapter_6_section_2.html#/ /apple_ref/doc/uid/TP40002978-CH7-SW20

In that case, it's simplest to put your custom initialization in awakeFromNib instead.

If you're creating your view programatically, then, yes, initWithFrame should be getting called.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to