Re: Attempt to nest an NSCollectionView fails.
Re: Attempt to nest an NSCollectionView fails.
- Subject: Re: Attempt to nest an NSCollectionView fails.
- From: Kevin Perry <email@hidden>
- Date: Tue, 23 Mar 2010 09:07:03 -0700
I'm not sure this is really a usage case that I'd expect to be well tested, since it seems a little out of the ordinary.
Anyway, which approach are you using for your prototype view? Is the view in the same nib, or have you factored it out into a separate nib, using the fact that NSCollectionViewItem became a subclass of NSViewController in Snow Leopard? If you're using the former, then the bindings may very well not be transferred correctly to each replicated view. Either switch to the Snow Leopard approach (highly recommended -- see the AppKit release notes for more details), or you can try overriding -newItemForRepresentedObject: and set up the bindings yourself.
-Kevin
On Mar 22, 2010, at 8:31 PM, Brian Krisler wrote:
> Hi,
>
> I am trying to nest an NSCollectionView inside an existing collection view and am not having much luck. The example I am building runs without issue, however the nested values do not appear.
>
> I currently have two model classes:
>
> @interface BlockModel : NSObject {
> NSString *blockTitle;
> NSMutableArray *blockItems;
> }
> @property (readwrite, retain) NSString *blockTitle;
> @property (readwrite, retain) NSMutableArray *blockItems;
> @end
>
> and
>
> @interface BlockItem : NSObject {
> NSString *itemName;
> NSString *itemDescription;
> }
> @property (readwrite, retain) NSString *itemName;
> @property (readwrite, retain) NSString *itemDescription;
> @end
>
> In my delegate, I have an NSMutableArray of blockModels.
>
> Then in Interface Builder, I have an NSCollection view with a label and a nested NSCollection view. The label contains the BlockModel.blockTitle (which displays correctly).
>
> To get content into the nested view, I have an Array Controller with the Content Array bound to the Collection View Item from the parent and a model Key Path of: representedObject.blockItems
>
> My nested collection view has its content bound to my Array Controller arrangedObjects. And my array controller is configured to be an object controller with the keys: itemName and itemDescription. I then have two labels in my nested collection view bound to the nested collection view item representedObject.itemName and representedObject.itemDescription.
>
> When I execute my code, I can see a few blocks with the proper titles, however the nest view is completely empty.
>
> Is there a step that I am missing?
>
> Thanks for any help.
>
> Brian
> _______________________________________________
>
> 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