Re: My Newbie Learning Question
Re: My Newbie Learning Question
- Subject: Re: My Newbie Learning Question
- From: "John C. Randolph" <email@hidden>
- Date: Wed, 6 Jun 2001 00:08:01 -0700
On Tuesday, June 5, 2001, at 08:20 PM, Michael Rogers wrote:
> As for remembering it, the Cocoa frameworks are pretty
self-consistent, so my first guess as to the name of a particular
method is usually right.
I agree. But I do have one complaint (and if the naming gods can
explain their rationale and/or provide a useful mnemonic, this humble
servant would be most appreciative :-) If I want to put an NSString in
an NSTextField, it looks like I need to use setStringValue, but if I
want to put it in an NSTextView, I need to use setString. Why didn't
they just choose one or the other?
The difference is that NSTextField is a control, and it also responds to
-setIntValue:, -setFloatValue:, etc. (IOW, -set<type>Value:)
NSTextView, on the other hand, doesn't just get a string value, it
(potentially) takes an attributed string, and keeps it in one of its own
instance variables.
-jcr
"These kids today don't know the simple joy of saving four bytes of
page-0 memory on a 6502" - unknown