Nscollectionview Sizeforitemat Always Returning Exception When Trying to Reference an Item in Its Collection

NSCollectionView indexPathForItem(at: point) returns nil for first item

Ok, nevermind. Turns out to be my fault.

For the scenario where the issue occurred I wanted to suppress the header.

Lazy as I am I just returned a plain NSView() as the header view in

func collectionView(_ collectionView: NSCollectionView, viewForSupplementaryElementOfKind kind: NSCollectionView.SupplementaryElementKind, at indexPath: IndexPath) -> NSView

I guess not returning a properly layout-constrained view messed up the collectionView layout.

NSCollectionView renders all NSCollectionViewItems at the same point

I've never seen this problem, but here's a guess:

In CollectionViewItem you are overriding loadView() but it never calls super.loadView(). CollectionViewItem is a subclass of NSViewController and if you override loadView() you must first invoke super.loadView() so the view controller can initialize its internal state.

If you're going to be targeting macOS 10.10 and later, you probably want to override viewDidLoad() instead.

Collection View not displaying properly

i used [arrayController removeObjects:[arrayController content]]; instead of [arrayController removeObjects:[arrayController arrangedObjects]];. i just replaced arranged objects to content.



Related Topics



Leave a reply



Submit