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: Wed, 12 Oct 2011 09:22:17 -0700
Ok,
A further update:
After doing some reading on this list, and some additional reading Apple's site, I learned that Core Animation is being used.
Just for fun, I in my NSCollectionViewItem's NSView, I called "setWantsLayers:YES". Suddenly my items started showing up!
(Well, they are showing up if you like garbage all over the NSView.)
In IB, I enabled the Core Animation Layer for my NSView. Then I enabled a Core Animation layer for my NSCollectionView.
Things are almost working! However:
- Not all of the imagery is properly re-drawn.
- Why is my first NSCollectionView working just fine, yet my second one needs all of these Animation layers enabled?
Progress at least!
My hunch is this: Two separate NSCollectionViews needs some Core Animation tweaking to make work.
bob.
On Oct 10, 2011, at 7:43 PM, Robert Monaghan wrote:
> 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