FROM : Matt Neuburg
DATE : Mon Jul 24 19:36:40 2006
On Sun, 23 Jul 2006 17:47:23 +0200, Robert Cerny <<email_removed>> said:
>Sorry for your bandwidth,
>I wasn't calling [super awakeFromNib];
I don't think that's a waste of bandwidth at all, since the problem of when
to call [super awakeFromNib] is one of the most vexed in Cocoa. Apple claims
explicitly in the docs at one point that "You do not need to call the super
implementation of awakeFromNib if your class descends directly from a Cocoa
class," but this simple-minded formulation seems wrong; counterexamples
arise sufficiently frequently that this should probably be called a bug in
the docs. In any case, knowing whether super *does* implement it is not
easy, since the docs don't tell you. A common convention (I use here a
formulation I noticed in some code by Mike Ash is):
if([[self superclass] instancesRespondToSelector:_cmd])
[super awakeFromNib];
It might be worthwhile to adopt this convention. m.
--
matt neuburg, phd = <email_removed>, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
DATE : Mon Jul 24 19:36:40 2006
On Sun, 23 Jul 2006 17:47:23 +0200, Robert Cerny <<email_removed>> said:
>Sorry for your bandwidth,
>I wasn't calling [super awakeFromNib];
I don't think that's a waste of bandwidth at all, since the problem of when
to call [super awakeFromNib] is one of the most vexed in Cocoa. Apple claims
explicitly in the docs at one point that "You do not need to call the super
implementation of awakeFromNib if your class descends directly from a Cocoa
class," but this simple-minded formulation seems wrong; counterexamples
arise sufficiently frequently that this should probably be called a bug in
the docs. In any case, knowing whether super *does* implement it is not
easy, since the docs don't tell you. A common convention (I use here a
formulation I noticed in some code by Mike Ash is):
if([[self superclass] instancesRespondToSelector:_cmd])
[super awakeFromNib];
It might be worthwhile to adopt this convention. m.
--
matt neuburg, phd = <email_removed>, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
| Related mails | Author | Date |
|---|---|---|
| Robert Cerny | Jul 23, 17:16 | |
| Robert Cerny | Jul 23, 17:47 | |
| Matt Neuburg | Jul 24, 19:36 | |
| Grigory Entin | Jul 24, 20:52 |






Cocoa mail archive

