Reputation: 243
Why use use IBOutlets instead of bindings?
Bindings in IB seem simpler.
What can IBOutlets do that bindings can't do?
Upvotes: 0
Views: 105
Reputation:
Bindings aren't a replacement for outlets, they're just another way of hooking certain aspects of a UI up. That said, there are a lot of things that bindings aren't very effective for that, for example, implementing NSTableViewDataSource
would allow you to handle (and you'd hook up said data source using an outlet).
Further, you're not about to get relevant views for your controller to interact with via a binding, but you can hook them up with outlets. In a sense, outlets are how you organize your objects — they might not do much on their own, but they provide data that you otherwise would have to dig around needlessly to get (sifting through subviews for a view with a given tag wouldn't be much fun and is really wasted effort given that you have outlets to simplify the whole process for you).
My main point though is that you shouldn't think of bindings as a replacement for outlets — they're not. Bindings can't replace outlets and outlets can't replace bindings. Bindings depend on outlets to an extent, so you couldn't get rid of them if you wanted to. Outlets, on the other hand, are just there to say what goes where. So that NSTextView
goes in property statusField
and that NSTableView
goes in property messagesTableView
.
So, again, outlets are organization, they aren't just something you use instead of bindings.
Upvotes: 1