• 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: What difference exist from where a method will be called?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What difference exist from where a method will be called?


  • Subject: Re: What difference exist from where a method will be called?
  • From: Graham Cox <email@hidden>
  • Date: Fri, 09 Sep 2016 00:01:52 +1000

> On 8 Sep 2016, at 11:13 PM, Raimond Hettrich <email@hidden> wrote:
>
> the init-method of the DelegateClass is running. This is because I have a class object in the Document.xib file


Alarm bells. What exactly does this mean?

I assume you mean you have a custom view within the document’s window, and you’ve set its class to ‘DelegateClass’. That is the normal way to add NSView subclasses in a xib. Depending on the ‘Prefer Coder’ checkbox for the xib, the -initWithFrame: or -initWithCoder: methods will be called. I don’t see that -init will ever be called. The only way to be sure is to set a debugger breakpoint in the -init method.

If you’ve added an object to the xib and set its class to ‘DelegateClass’ as well as having a view in the window, you’ll have two of them. One is on screen and is reporting from its -drawRect method, the other is the one that’s responding to the button and showing its array. If that’s the case, its -init method WILL be called, because it’s being treated as a plain object, not an NSView.

From what you’ve described, this would fit the logging output you’re seeing, but because you haven’t logged the identity of the view itself, you haven’t seen that there are two. A breakpoint would reveal that, because you can see the address of the object.

—Graham



_______________________________________________

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: What difference exist from where a method will be called?
      • From: Raimond Hettrich <email@hidden>
References: 
 >What difference exist from where a method will be called? (From: Raimond Hettrich <email@hidden>)
 >Re: What difference exist from where a method will be called? (From: Jens Alfke <email@hidden>)
 >Re: What difference exist from where a method will be called? (From: Raimond Hettrich <email@hidden>)
 >Re: What difference exist from where a method will be called? (From: Graham Cox <email@hidden>)
 >Re: What difference exist from where a method will be called? (From: Raimond Hettrich <email@hidden>)

  • Prev by Date: Re: What difference exist from where a method will be called?
  • Next by Date: Re: What difference exist from where a method will be called?
  • Previous by thread: Re: What difference exist from where a method will be called?
  • Next by thread: Re: What difference exist from where a method will be called?
  • Index(es):
    • Date
    • Thread