Oh man, You got it! That’s the solution. I study as conscionable as I can, but until now I thought an object in the nib is just a connection to the class, but now I'm feeling very silly because it’s obvious that it is an object and if the object is named like a existing class it’s just another instance of it.
Thank You very much for Your time and Your knowledge! Raimond > Am 08.09.2016 um 16:01 schrieb Graham Cox <[email protected]>: > > >> On 8 Sep 2016, at 11:13 PM, Raimond Hettrich <[email protected]> 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 protected]) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
