• 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: Converting a Storyboard into separate NIBs.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting a Storyboard into separate NIBs.


  • Subject: Re: Converting a Storyboard into separate NIBs.
  • From: David Duncan <email@hidden>
  • Date: Mon, 19 Jun 2017 15:42:56 -0700

> On Jun 19, 2017, at 3:37 PM, Charles Srstka <email@hidden> wrote:
>
>> On Jun 19, 2017, at 4:29 PM, Alex Zavatone <email@hidden> wrote:
>>
>> From line 153 of UIViewController.h:
>>
>>  As a convenience, the default init method will do this for you,
>>  and specify nil for both of this methods arguments.) In the specified NIB,
>> the File's Owner proxy should
>>  have its class set to your view controller subclass, with the view outlet
>> connected to the main view. If you
>>  invoke this method with a nil nib name, then this class' -loadView method
>> will attempt to load a NIB whose
>>  name is the same as your view controller's class.
>>
>> The pearl is here:
>>
>> If you
>>  invoke this method with a nil nib name, then this class' -loadView method
>> will attempt to load a NIB whose
>>  name is the same as your view controller's class.
>
> The documentation begs to differ, though:

AppKit vs UIKit – your both right for the respective frameworks you are
speaking to.

>
> https://developer.apple.com/documentation/appkit/nsviewcontroller/1434405-loadview
>
>> Prior to OS X v10.10, the loadView() method did not provide well-defined
>> behavior if the nibName property’s value was nil. In macOS 10.10 and later,
>> however, you get correct behavior without specifying a nib name as long as
>> the nib file’s name is the same as that of the view controller. For example,
>> if you have a view controller subclass called MyViewController and a nib
>> file with the same name, you can employ the convenient initialization
>> pattern [[MyViewController alloc] init].
>
> The AppKit release notes agree:
>
> https://developer.apple.com/library/content/releasenotes/AppKit/RN-AppKitOlderNotes/index.html#10_10ViewController
>
>> loadView: would previously not have well defined behavior if there was a
>> "nil" nibName. On 10.10 and later, if nibName is nil NSViewController will
>> automatically try to load a nib with the same name as the classname. This
>> allows a convenience of doing [[MyViewController alloc] init] (which has a
>> nil nibName) and having it automatically load a nib with the name
>> "MyViewController”.
>
> The sense I get from these methods is that it might have kinda, sorta,
> accidentally worked in the past, but it shouldn’t be relied on.
>
> Reading through those release notes reminded me of *another* caveat I’d
> forgotten; the functionality only correctly parses Swift class names in
> *10.11* and higher. Otherwise, it’ll be looking for MyProjectName.Foo.xib
> instead of Foo.xib like it should. So, if you’re using Swift, better to
> restrict usage of this feature to El Cap or better.
>
> Charles
>
> _______________________________________________
>
> 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

--
David Duncan

_______________________________________________

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: 
 >Converting a Storyboard into separate NIBs. (From: Dave <email@hidden>)
 >Re: Converting a Storyboard into separate NIBs. (From: Alex Zavatone <email@hidden>)
 >Re: Converting a Storyboard into separate NIBs. (From: Charles Srstka <email@hidden>)
 >Re: Converting a Storyboard into separate NIBs. (From: Alex Zavatone <email@hidden>)
 >Re: Converting a Storyboard into separate NIBs. (From: Charles Srstka <email@hidden>)

  • Prev by Date: Re: Converting a Storyboard into separate NIBs.
  • Next by Date: Re: Converting a Storyboard into separate NIBs.
  • Previous by thread: Re: Converting a Storyboard into separate NIBs.
  • Next by thread: Re: Converting a Storyboard into separate NIBs.
  • Index(es):
    • Date
    • Thread