The obvious first question to me is: is your notification actually firing? Mike.
> On 6 Apr 2019, at 22:46, Demitri Muna <cocoa-...@demitri.com> wrote: > > Hello, > > I have a 10.11+ NSCollectionView. I have two representations (subclasses of > NSCollectionViewItem) of the data - one large and one small. When the view is > resized to be narrower than the large representation, I’d like to swap the > views to the smaller versions. Similarly, when the window is widened enough > to accommodate at least a single of the larger views, I’d like the views to > change again. I’ve not been able to make this work. > > I have set up an NSViewBoundsDidChangeNotification so I know when the width > of the view crosses the threshold. I’ve tried: > > - [collectionView reloadData] > - [collectionView.collectionViewLayout invalidateLayout] (on the > NSCollectionViewFlowLayout) > > I think I just want to invalidate all of the already created views and get > the collection view to call makeItemWithIdentifier:forIndexPath: again. > > One option I haven’t explored is to handle the change within a single > NSCollectionViewItem subclass (two views in the one .xib), but since the > representations are sufficiently different (e.g different number of subviews) > I’m worried about running into auto layout issues during the transition. Also > it feels messier. > > Bonus points for how to accomplish this with animation! > > Thanks, > Demitri > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/mabdullah%40karelia.com > > This email sent to mabdul...@karelia.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com