Re: categories question...
Re: categories question...
- Subject: Re: categories question...
- From: Philip George <email@hidden>
- Date: Sun, 13 Jul 2003 08:10:42 -0500
Thanks to everyone who responded. All of your input was great. About 10
minutes ago I found a MUCH less hacky way to do what I wanted to do, totally
eliminating the need for the category. But, thanks to your responses, if I
ever do need to use a category in the future, I'll at least have a better
idea of what they can and cannot do. :)
Thanks.
- Philip
On 7/13/03 8:03 AM, "Jonathan Jackel" <email@hidden> wrote:
>
>
On Sunday, July 13, 2003, at 05:43 AM, Philip George wrote:
>
>
> @implementation NSLayoutManager (myLayoutManagerAdditions)
>
> - (id)init {
>
> if (self = [super init]) {
>
> // do some post-init initting
>
> // for now though, it's literally just this comment
>
> }
>
> return self; // here's where i get the EXC_BAD_ACCESS
>
> }
>
> @end
>
>
As Gerard said, you are replacing NSLayoutManager's init method, so
>
your call to [super init] is actually calling NSObject's init.
>
NSLayoutManager probably does some setting up of its instance variables
>
(retaining some things, perhaps) and since you tell it not to, when
>
your code (or AppKit) tries to get to those variables, it goes kablooey.
>
>
The simplest thing would be to subclass NSLayoutManager to override
>
init. Then calling super will do what you want. You can leave your
>
category in place. Those methods will work in your subclass. Or you
>
can move those methods to your subclass.
>
>
Jonathan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.