Skip navigation.
 
mlRe: NSCollectionView questions
FROM : David Carlisle
DATE : Mon Feb 11 23:59:44 2008

I needed to put a pop up menu inside a view of a NSCollectionViewItem, 
then customize the contents of the menu using the representedObject.

I subclassed NSCollectionViewItem and augmented setView to cause 
"self" to be the delegate of the NSPopUpButton menu, obtained with 
[view ViewWithTag:n].

That subclass has a method for MenuNeedsUpdate which passes the 
message to its NSCollectionView along with a copy of the 
representedObject.

My subclass of NSCollectionView has an IBOutlet for the Window 
Controller, so it can pass the message there where the menu can be 
customized.

Hope that helps,
DC

On Feb 11, 2008, at 2:19 PM, Dave Hayden wrote:

> On Feb 9, 2008, at 6:21 AM, David Carlisle wrote:
>

>> I don't understand exactly what you are trying to do, but your 
>> workaround sounds more complicated that the ones I am using.

>
> If I subclass the view used for the collection view items and put 
> IBOutlets in those views, the references aren't retained when the 
> item views are created. So I can't reference the subviews of that 
> view by linking them with outlets and I can't get a reference from 
> the view to the item controller object.
>
> Can you describe your workaround?
>
> Many thanks,
> -Dave
>

Related mailsAuthorDate
mlNSCollectionView questions Dave Hayden Feb 6, 23:07
mlRe: NSCollectionView questions Dave Hayden Feb 9, 00:04
mlRe: NSCollectionView questions Carter R. Harrison Feb 9, 00:54
mlRe: NSCollectionView questions David Carlisle Feb 11, 23:59
mlRe: NSCollectionView questions Adhamh Findlay Feb 12, 00:15
mlRe: NSCollectionView questions David Carlisle Feb 12, 06:47
mlRe: NSCollectionView questions Dave Hayden Feb 12, 23:02
mlRe: NSCollectionView questions David Carlisle Feb 13, 00:05