Re: drawRect not being called by NSCollectionView..
Re: drawRect not being called by NSCollectionView..
- Subject: Re: drawRect not being called by NSCollectionView..
- From: Robert Monaghan <email@hidden>
- Date: Mon, 10 Oct 2011 19:43:08 -0700
Well,
After some troubleshooting, it looks like the NSView that is attached to the NSCollectionViewItem object is missing its superview.
Does any know how this might be possible??
I can see my Subclassed NSView being created. AwakeFromNib works, as does hitTest.
The drawRect does get called, but the call to superview fails, because it is set to nil.
Just for laughs, I created another NSCollectionView, with NSArrayController, etc, and manually add objects. This works, with the NSViews displaying properly.
Is there a way to force NSCollectionView to reload/re-display the NSViews with a proper superview set?
bob.
On Oct 10, 2011, at 4:49 PM, Robert Monaghan wrote:
> Hi Everyone,
>
> I can't seem to get an NSCollectionView to render an of the NSCollectionViewItems' NSViews.
>
> I have an NSCollectionView that is bound to an NSArrayController's arrangedObjects.
> The NSCollectionViewItem is set up as a template, and also has its Outlet attached to an NSView.
> For fun I added a text label as well as an image from the Media Library, as a placeholder image on the NSView.
> (It helps to have something to look at!)
>
> I don't have anything bound to the NSView at all.
> I haven't subclassed anything either. These are the standard objects within IB.
>
> My App inserts objects into an array using the NSArrayController as needed.
> However, as this happens, *nothing* is rendered at all. As a test, I have subclassed the NSView, and checked the drawRect method.
>
> Nothing.
>
> I enabled selectable in my NSCollectionView and checked for a hitTest method in my view. I can blindly click inside the NSCollectionView to the approximate location of the view, and see an hitTest response. Strange! So I know that my NSView is being recognized by my NSCollectionView, as hitTest is being called. But drawRect isn't happening.
>
> Can anyone hazard a guess at what I am doing wrong?
>
> Some notes..
> This interface is to drive a network device. As such, the UI doesn't actually populate with anything until it is discovered over the network.
> As a matter of fact, the array that the NSArrayController uses doesn't even exit during the "awakeFromNib" process. The actual array is created as soon as the device comes online, and is attached using a binding. Perhaps I need to send some sort of message to the NSCollectionView after the new array is bound?
>
> Thanks!
>
> bob.
>
> _______________________________________________
>
> 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