• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Dynamically change NSCollectionView items based on view width
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamically change NSCollectionView items based on view width


  • Subject: Re: Dynamically change NSCollectionView items based on view width
  • From: Mike Abdullah <email@hidden>
  • Date: Sun, 07 Apr 2019 21:20:28 +0100

The obvious first question to me is: is your notification actually firing?

Mike.

> On 6 Apr 2019, at 22:46, Demitri Muna <email@hidden> 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 (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

  • Follow-Ups:
    • Re: Dynamically change NSCollectionView items based on view width
      • From: Demitri Muna <email@hidden>
References: 
 >Dynamically change NSCollectionView items based on view width (From: Demitri Muna <email@hidden>)

  • Prev by Date: Re: NSTextField "Discard Change"
  • Next by Date: Re: Dynamically change NSCollectionView items based on view width
  • Previous by thread: Re: Dynamically change NSCollectionView items based on view width
  • Next by thread: Re: Dynamically change NSCollectionView items based on view width
  • Index(es):
    • Date
    • Thread