Some days, I just want to bash my head against the wall. This is especially true when dealing with Cocoa and Apple's super generic documentation. (Apple's documentation is actually really good, I'm just angry that I can't figure this out)
Okay, so I have a class 'IOWallpaper' that stores a 'name' and a 'path' — which is hooked up to an ArrayController
This ArrayController is then hooked up to a NSCollectionView so that the NSCollectionView can be populated with NSCollectionViewItem's.
I am trying to make it so that you can select ONE item within the NSCollectionView and when you click on that item, it returns it's represented IOWallpaper object from the array.
The closest I've got to achieving this is by setting the 'Selection Indexes' binding on the NSCollectionView, and then using an observeValueForKeyPath for the 'selectionIndexes' key. It knows that I've selected the 1 object, but I can't get the IOWallpaper object back from the NSArrayController object that is returned using the observer.
- Here is a screenshot of the issue: http://cl.ly/YHoQ
So essentially, I want to convert the (id) 'object' parameter in observeValueForKeyPath back to an IOWallpaper object so that I can access it's members?
This probably makes no sense whatsoever, but it's the best I can explain it.
Thank you for listening.