Re: unconnected TextFields
Re: unconnected TextFields
- Subject: Re: unconnected TextFields
- From: publiclook <email@hidden>
- Date: Thu, 23 Oct 2003 21:37:04 -0400
On Thursday, October 23, 2003, at 07:06 PM, Robert Clair wrote:
Bingo! That was certainly it. Thanks for keeping me from wasting even
more time.
But a question. I know the naming convention, but a convention is just
that: a convention. There shouldn't be capital punishment for not
observing a convention. Is there something in the docs or the 20 lbs
of Cocoa books I read that says in really big International Orange
letters "If you have an outlet named ralphAndNorton nice Mr. IB is
going to make a method named setRalphAndNorton for you and if you
accidentally override it you are going to have a very unpleasant day"
???
I admit to being impatient with reading books...
If not, who do I shoot and where do I apply for the permit ? :-)
<Quote>
establishConnection
- (void)establishConnection
Establishes an outlet connection. If the label is a method name of the
form setValue: (where Value can be anything), then that method is
called on the source with the destination as the parameter. If the
label is the name of an instance variable in the source, then that
instance variable is set to the destination.
<End Quote>
- or -
<Quote>
takeValue:forKey:
- (void)takeValue:(id)value forKey:(NSString *)key
Sets the value for the property identified by key to value, invoking
handleTakeValue:forUnboundKey: if the receiver doesn't recognize key
and unableToSetNilForKey: if value is nil and key identifies a scalar
property.
The default implementation works as follows:
1. Searches for a public accessor method of the form setKey, invoking
it if there is one.
2. If a public accessor method is not found, searches for a private
accessor method of the form _setKey, invoking it if there is one.
3. If an accessor method is not found and the class method
accessInstanceVariablesDirectly returns YES, takeValue:forKey: searches
for an instance variable based on key and sets the value directly. For
the key "lastName", this would be _lastName or lastName.
4. If neither an accessor method nor an instance variable is found, the
default implementation invokes handleTakeValue:forUnboundKey:.
<End Quote>
Both are very useful features, and there is no other convenient way for
you to insert arbitrary code into the nib outlet connection process.
This is no more about conventions then saying device drivers need to
implement open(), close(), and ioctl(). It is a design rather than a
convention. There is a defined interface that will be used if present
when loading a nib just like a driver's open() function will be used if
present when a user uses the open() system call and specifies a
particular driver.
This is also well explained in this forum, in comp.sys.next.*, and many
other places. probably ALL of the available Cocoa book mention this.
_______________________________________________
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.