• 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: NSView subclass does not call designated initializer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSView subclass does not call designated initializer


  • Subject: Re: NSView subclass does not call designated initializer
  • From: Roland King <email@hidden>
  • Date: Mon, 22 Aug 2011 21:13:30 +0800

it's calling initWithCoder:

read the NIB Object Life Cycle section in the documentation

"In iOS, any object that conforms to the NSCoding protocol is initialized using the initWithCoder: method. This includes all subclasses of UIView and UIViewController whether they are part of the default Interface Builder library or custom classes you define."

On Aug 22, 2011, at 8:57 PM, allan greenier wrote:

> This is for an iPhone app.I've made a subclass (named Box) of NSView, Xcode 4.1 made it with a designated initializer for me to fill out.
> - (id)initWithFrame:(CGRect)frame
> I've dropped a view into my window in Interface Builder, set it's class to Box.
> I am *positive* that the view is my class.
> When I run the app, the designated initializer does not run.
> I have an NSLog in there to prove it to myself.
>
> Is there something else I have to do to get IB to call the designated Initializer?
> It acts as if it's calling [[Box alloc] init] instead ...
>
> Here's the implementation code.
>
> - (id)initWithFrame:(CGRect)frame
> {
>     NSLog(@"Box initWithFrame");
>     self = [super initWithFrame:frame];
>     if (self)
>     {
>         // Initialization code
>  //       [self hookMeUpBaby];
>
>     }
>     return self;
> }
> _______________________________________________
>
> 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

References: 
 >NSView subclass does not call designated initializer (From: allan greenier <email@hidden>)

  • Prev by Date: Re: NSView subclass does not call designated initializer
  • Next by Date: Re: Exception getting shared font panel
  • Previous by thread: Re: NSView subclass does not call designated initializer
  • Next by thread: printDocument: hangs on Lion?
  • Index(es):
    • Date
    • Thread