[Openmcl-devel] A question on how to implement delegate methods
mevins at mac.com
Fri Feb 1 08:58:01 PST 2008
On Feb 1, 2008, at 9:05 AM, Didier Verna wrote:
> Hello again,
> suppose that I have an outline-view somewhere, with a delegate of
> main-window-controller. It is not clear to me how I would implement
> following delegate method (objc prototype):
> - (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:
>> From what I understand (correct me if I'm wrong), I would need a
> of the form:
> #/outlineView: (<delegate> <the-outline-view> &key should-select-item)
> but what if I don't want to implement the other oulineView: delegate
> methods myself ?
Objective-C supports enough reflection that the runtime can ask an
object whehter it responds to a message. If a delegate doesn't
implement a method for a message, the AppKit doesn't send that message.
In other words, it's okay to implement a delegate that responds to
only some of the messages it can be sent.
More information about the Openmcl-devel