Re: Seemingly bizzare calling of method
Re: Seemingly bizzare calling of method
- Subject: Re: Seemingly bizzare calling of method
- From: Mike Abdullah <email@hidden>
- Date: Mon, 16 Jan 2006 09:21:30 +0000
Thanks Cameron, I will indeed go and do some background reading.
Mike.
On 16 Jan 2006, at 05:04, Cameron Hayne wrote:
On 15-Jan-06, at 7:10 PM, Mike Abdullah wrote:
My method is actually called "setEventTitle:" and I have an
IBOutlet in the same class called "eventTitle." If I rename the
method to something slightly different then this doesn't happen.
So, what can I do to stop this? I'm fairly new to Cocoa, so I'm
not really sure here! I mean, yes I could easily just choose an
alternative name, but the method and the outlet are supposed to be
fairly closely tied together.
You should go and read the docs about key-value coding and the
naming conventions that go with it.
But until then, I recommend that you merely change your own naming
conventions for outlets to include some suffix that indicates what
type of control they are. For example, use "eventTitleTxf" for the
outlet (assuming it is a Textfield).
The underlying issue here is that you seem not to be distinguishing
between your "model" and your "view". A textField is part of the
view. The job of the textField is to display the value. The value
is not stored in the textField - it should be stored in your model
- e.g. in an instance variable named "eventTitle". And the method
that sets this instance variable to some given value would be
called "setEventTitle".
--
Cameron Hayne
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden