Re: initWithFrame fails
Re: initWithFrame fails
- Subject: Re: initWithFrame fails
- From: N!K <email@hidden>
- Date: Fri, 26 Dec 2014 22:44:47 -0800
Thank you. I was looking at the Identity Inspector. Finding that check box was very clever. Your reasoning below is well thought out.
Nick
On Dec 26, 2014, at 10:13 PM, Roland King < email@hidden> wrote:
On Dec 26, 2014, at 5:57 PM, Roland King < email@hidden> wrote: I now know why it does this, it’s another unexpected, undocumented, not-in-the-release-notes-as-far-as-I-can-find-even-searching-for-it feature of Xcode 6. If you click on the xib/nib file and look at its inspector information, just below the bit about using autolayout is a section called ‘runtime behavior’ and under that is ‘Instantiation: Prefer coder’ which for me was checked on by default in a new project. if you toggle that on and off you’ll get initWithCoder: when on and initWithFrame: when off.
Sorry, I don’t find this. I don’t find ‘runtime behavior’. “User Defined Runtime Attributes” is the closest, but not right. I’m in Xcode 6.1.1.
This is the inspector. <Screen Shot 2014-12-26 at 7.09.26 PM.jpg>
Nick
Please stay on-list.
You’re looking in the wrong place. Select the xib and then View->Utilities->Show File Inspector, or Option-Command-1
But I wouldn’t bother unchecking it even when you do find it for 3 reasons.
1) That’s clearly the direction Apple is taking and it’s normally better to row in the same direction than against it, although I wish they wouldn’t keep things like this a secret. I don’t even see that option with Storyboards, only NIB. Storyboards are pretty obviously going to be the new default pretty soon and I’m reasonably sure that my custom views are getting initWithCoder: out of storyboards at this point.
2) It’s arguably more consistent, you get initWithCoder: for stuff which comes out of a NIB without having to remember that NSView subclasses work differently for some historical reason.
3) It shouldn’t matter. If you need something done in your custom NSView subclass which must be done at init* time, factor it out and call it from initWithFrame: and initWithCoder: and then it matters not how your view gets created, it’ll work.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden