FROM : Grigory Entin
DATE : Mon Jul 24 20:52:00 2006
Hi,
Just in case, can you comment on the following solution: just define
(an empty) -awakeFromNib in NSObject category and *always* [super
awakeFromNib] in subclasses?
It sounds a bit like a hack but I prefer it rather than other
solutions. :-)
Regards,
Grigory
On Mon Jul 24 2006 at 21:36, Matt Neuburg <<email_removed>> wrote:
> 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.
DATE : Mon Jul 24 20:52:00 2006
Hi,
Just in case, can you comment on the following solution: just define
(an empty) -awakeFromNib in NSObject category and *always* [super
awakeFromNib] in subclasses?
It sounds a bit like a hack but I prefer it rather than other
solutions. :-)
Regards,
Grigory
On Mon Jul 24 2006 at 21:36, Matt Neuburg <<email_removed>> wrote:
> 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.
| 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

