Domanda

I've done quite a bit of Cocoa programming, both on OS X and iOS, and I've gained quite a bit of experience on what works, and what doesn't, with regards to how things generally fit together. However, there are still a lot of aspects of Cocoa architecture that aren't quite clear, and I'm wondering if there may be some sort of guide/book/etc. explaining how some of those things work.

For example, one I've come across recently:

  • Setting up a NSViewController and binding its 'representedObject' to the 'selection' of a NSArrayController, then binding UI elements to that representedObject, doesn't work. Why not? What's the best way to handle that situation? I ended up setting the NSArrayController as its representedObject but that seems off - is that a bad design?

There are a lot of other small things as well that I've wondered about in the past - things like how best to set up custom views. (I actually used to create a blank NSView in Interface Builder, then create my custom view in code and set it as the subview of that view!) Cocoa is incredibly flexible, and there are a lot of ways to accomplish the same thing, but clearly some of them, like that, can cause problems down the road.

There are a lot of reference materials on the Apple developer site that I haven't had the time to go through, and I'm sure a lot of this is covered in various documents, but sometimes a third-party resource can be helpful and can also bring up situations that aren't covered in the main documentation. Any thoughts?

È stato utile?

Soluzione

I don't know if it answers your specific questions or not, but Cocoa Design Patterns by Buck and Yacktman is good on why experienced Cocoa developers do things a particular way.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top