NSCollectionView question

2 views
Skip to first unread message

Demitri Muna

unread,
Jan 8, 2019, 2:27:50 PM1/8/19
to CocoaHeadsNYC
Hi,

Since I’m not sure about cocoa-dev, I’ll try asking my question here. I have an NSCollectionView (macOS, need to support the legacy mode). The collection view is set up in a split view and works. What I’d like to do is when the split view is narrowed below a given with, I want to swap the item views to miniature versions. When I detect this, I grab the collection view’s “itemPrototype”, which is a subclass of NSViewController, and swap the “view” property to a smaller view. This is causing auto-layout headaches as I’m not exactly sure the order of views being set up, particularly at load time.

Is this a good approach? I can think of a few others, but wanted to take a step back before coding it again. Other options:

* swap out the collection view itself (i.e. have two handy with both pointing to the same array controller)
* swap out the item prototype (but how to trigger a redraw/reload?)
* swap out the item prototype’s views?
* something else?

In any event, I want the views updated during the drag as well.

Any thoughts welcome!

Cheers,
Demitri

Reply all
Reply to author
Forward
0 new messages