Date
1 - 5 of 5
Sizing NSCollectionViewItems to fit
Steve Mills
On Jun 27, 2017, at 03:07 PM, Steve Mills <sjmills@...> wrote:
I'm doing the development of a small app on 10.10, so all the 10.11 additions to NSCollectionView aren't available. I have a window filled with an NSCollectionView in a scrollview, which contains 1 row and scrolls horizontally, and I'd like to resize the NSCollectionViewItems (which are subclassed) to proportionally fit the height of the collection view at the time of being inserted and when the window resizes.I tried changing the bounds of the itemPrototype in a notification for the collection view's frame being changed, but that's probably not all that needs to happen. Any ideas?
Got it working simply by changing the collectionView.maxItemSize to the size I want in the NSViewFrameDidChangeNotification callback. Whodathunk.
Sent from iCloud's ridiculous UI, so, sorry about the formatting
Steve Mills
On Jun 27, 2017, at 03:36 PM, Jon Gotow <gotow@...> wrote:
Did you call -reloadData after resizing the itemPrototype? You have to get the collection view to regenerate all the views with the newly resized prototype.
Annoyingly, reloadData wasn't introduced until 10.11, so that's not going to work.
Sent from iCloud's ridiculous UI, so, sorry about the formatting
Jon Gotow
On Jun 27, 2017, at 2:07 PM, Steve Mills <sjmills@...> wrote:Did you call -reloadData after resizing the itemPrototype? You have to get the collection view to regenerate all the views with the newly resized prototype.
I'm doing the development of a small app on 10.10, so all the 10.11 additions to NSCollectionView aren't available. I have a window filled with an NSCollectionView in a scrollview, which contains 1 row and scrolls horizontally, and I'd like to resize the NSCollectionViewItems (which are subclassed) to proportionally fit the height of the collection view at the time of being inserted and when the window resizes.
I tried changing the bounds of the itemPrototype in a notification for the collection view's frame being changed, but that's probably not all that needs to happen. Any ideas?
- Jon
Steve Mills
I'm doing the development of a small app on 10.10, so all the 10.11 additions to NSCollectionView aren't available. I have a window filled with an NSCollectionView in a scrollview, which contains 1 row and scrolls horizontally, and I'd like to resize the NSCollectionViewItems (which are subclassed) to proportionally fit the height of the collection view at the time of being inserted and when the window resizes.
I tried changing the bounds of the itemPrototype in a notification for the collection view's frame being changed, but that's probably not all that needs to happen. Any ideas?
Sent from iCloud's ridiculous UI, so, sorry about the formatting