Ahhh. I was thinking there might be some reasoning behind it that
would teach me something important about obj-c, but it's just the
position in the file then :) (I wonder how far you could get without
declarations, just by reordering your methods? not a good coding
style! ;)

I'm using the @synthesize stuff rather than doing the methods
manually, and just overriding the setValue: part to add some
customising, it saves finger wear.

Thanks for the help!

Chris


2009/9/25 Christopher Wright <[email protected]>:
>> The error was strange though, can anyone explain it?
>> Basically I used [self setSaturation:1.0]; twice, once in awakeFromNIB
>> and once when called from a button. It worked fine without any build
>> error in the awakeFromNIB, but gave me the usual 'object may not
>> respond to selector' error when called from my button's target method.
>> Why would it work in one place and not another?!
>
> Let's welcome our friend Forward Declaration to the party!   (
> http://en.wikipedia.org/wiki/Forward_declaration )
>
>
> Here's an example:
>
>
>
> in -someMethod, we call -doCoolStuff.  -doCoolStuff isn't listed in the
> @interface block.  Since the invocation happens before the method's defined,
> the compiler complains (it hasn't seen the -doCoolStuff method, it isn't
> defined, and thus, it doesn't know what its signature looks like -- the
> compiler works from the top down for the most part, and likes to know return
> types and argument types in advance).
>
> Then we define -doCoolStuff.
>
> Afterwards, we have -someOtherMethod, which also calls -doCoolStuff.  Since
> the compiler has seen -doCoolStuff by that point, it's ok with it -- it
> knows what the prototype looks like, etc.
>
> Sometimes this is innocuous, but it can also cause bizarre stack/type quirks
> if you return structures or doubles (or floats in 32bit mode, perhaps?  not
> experimented much with that case, to be honest).
>
> To address this, in the @interface, simply add -(void)doCoolStuff;.   or,
> add it to a category right above the @implementation in the .m file.
>
> --
> [christopher wright]
> [email protected]
> http://kineme.net/
>
>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to