• 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's in Separate NIB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSView's in Separate NIB


  • Subject: Re: NSView's in Separate NIB
  • From: Lee Ann Rucker <email@hidden>
  • Date: Fri, 04 Sep 2015 20:25:48 +0000
  • Thread-topic: NSView's in Separate NIB

NSViewController doesn’t really work that way. It’s like an NSWindowController - it manages one view and handles all the nib unloading top-level objects stuff for you. (Trust me, you do not want to manage top-level objects yourself)

So instead of

> myDetailView = [LTWDetailView loadViewFromNIB:@“ LTWDetailViewY”]l
> myDetailViewController = [[LTWDetailViewController alloc] initWithDetailView:theDetailView];

what you’d want is

myDetailViewController = [[LTWDetailViewController alloc] initWithNibName:@“ LTWDetailViewY”]
myDetailView = [myDetailViewController view];


On Sep 4, 2015, at 10:58 AM, Dave <email@hidden> wrote:

>
>> On 4 Sep 2015, at 18:40, Conrad Shultz <email@hidden> wrote:
>>
>>
>>> On Sep 4, 2015, at 10:30 AM, Dave <email@hidden> wrote:
>>>
>>> The reason I ask is that for a while now when you create an NSView subclass it no longer offers you the option to create a separate NIB file. I remember a while back reading something saying that it was frowned upon.
>>>
>>
>> You should be able to create a xib for an empty view, create an class file, and set the view's custom class in the xib.
>>
>> I'm not sure about being frowned upon, but I would consider also creating an NSViewController subclass that is responsible for loading your view's nib, performing associated logic, and connecting it to the rest of your code.
>
> I already have a View Controller I want to Pass in Views to it and have it add them as subviews of the main view.
>
> Basically I have a list of Detail Items with a Disclosure Triangle Button and a Title for each one.
>
>> TITLE			Undisclosed
> Subview is Not Shown
>
> V TITLE			Disclosed
> Subview Is shown.
>
> The idea is to create the View Controller for each item in code and pass in a detail view to something like this:
>
>
> LTWDetailViewController*	myDetailViewController;
> LTWDetailView*			myDetailView;
>
> myDetailView = [LTWDetailView loadViewFromNIB:@“ LTWDetailViewX”]l;
> myDetailViewController = [[LTWDetailViewController alloc] initWithDetailView:theDetailView];
>
> myDetailView = [LTWDetailView loadViewFromNIB:@“ LTWDetailViewY”]l;
> myDetailViewController = [[LTWDetailViewController alloc] initWithDetailView:theDetailView];
>
> initWithDetailView creates an instance of the VC saves the LTWDetailView passed to it in a property and then adds this view as a Subview (taking care of any constraints (hopefully)).
>
> All the Best
> Dave
>
>
> _______________________________________________
>
> 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


  • Follow-Ups:
    • Re: NSView's in Separate NIB
      • From: Dave <email@hidden>
References: 
 >NSView's in Separate NIB (From: Dave <email@hidden>)
 >Re: NSView's in Separate NIB (From: Conrad Shultz <email@hidden>)
 >Re: NSView's in Separate NIB (From: Dave <email@hidden>)
 >Re: NSView's in Separate NIB (From: Conrad Shultz <email@hidden>)
 >Re: NSView's in Separate NIB (From: Dave <email@hidden>)

  • Prev by Date: Re: Auto Layout Problems
  • Next by Date: String.join()?
  • Previous by thread: Re: NSView's in Separate NIB
  • Next by thread: Re: NSView's in Separate NIB
  • Index(es):
    • Date
    • Thread