On Apr 4, 2011, at 7:09 PM, Kyle Sluder wrote:

On Mon, Apr 4, 2011 at 2:26 PM, Carlos Eduardo Mello
<carloseme...@gmail.com> wrote:
I am new to this but, (just in case...) have you, by any chance, named a function in your delegate as a setter for your outlet (setTextField:)? I fell into that trap a little while ago: -awakeFromNib is called before the
outlet is connected and it never gets wired to the nib.

o_O -awakeFromNib is called after all the outlets are hooked up.
That's its entire purpose.

Sorry, I meant 'windowControllerDidLoadNib', but that obviously only makes sense in a document based app, which is where I saw it.

Still, if you look at this little test app (public link to Google Docs), you'll see what I mean. There is an AppController class, (which was made the window's delegate) with an outlet connected to a text field and a button in the window. The button calls an Action called 'setTextField', but the 'textField' outlet is never available when the button is clicked. The outlet wasn't wired, even though it is correctly connected in IB. Now if you change the button's action name to fillTextField (or anything other than setTextField), everything works ok -- the field is there waiting to be accessed.

https://docs.google.com/leaf?id=0B5t9N8FvFoJIOTk3NTY4ODItYzg4NS00ZmFmLWE3MzYtZjllYmIwY2ZiY2Q4&hl=en&authkey=CIzbnLIG

So I really learned that lesson: never give an accessor name to anything that is not meant to be an accessor.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to