• 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: trying to glue a cocoa ui to a pthread application / subclassing nsview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trying to glue a cocoa ui to a pthread application / subclassing nsview


  • Subject: Re: trying to glue a cocoa ui to a pthread application / subclassing nsview
  • From: Quincey Morris <email@hidden>
  • Date: Mon, 2 Jun 2008 20:29:46 -0700


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 (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: 
 >trying to glue a cocoa ui to a pthread application / subclassing nsview (From: Michael Toy <email@hidden>)

  • Prev by Date: Re: many-to-many relationships and retain cycles
  • Next by Date: Getting started with Core Animation
  • Previous by thread: trying to glue a cocoa ui to a pthread application / subclassing nsview
  • Next by thread: Re: trying to glue a cocoa ui to a pthread application / subclassing nsview
  • Index(es):
    • Date
    • Thread