• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSString help!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString help!


  • Subject: Re: NSString help!
  • From: Bill Bumgarner <email@hidden>
  • Date: Wed, 25 Jun 2008 23:21:22 -0700

On Jun 25, 2008, at 11:05 PM, Omar Qazi wrote:
On Jun 25, 2008, at 10:44 PM, Eric Lee wrote:
Okay, I've done this:

[labelField setstringValue:[textField StringValue]];

However, when I build it, and I type something in and then press the button,
the string doesn't show up on the labelField IBOutlet.


How can I resolve this?

Ok, Cocoa is case sensitive. What this means is that stringValue is not the same thing as StringValue.

All methods in Cocoa follow the naming convention of starting lower case and having each word after that uppercase

likeThis:

So basically, stringValue: and setStringValue: are the methods you need to use.

What Omar said.

Let me add one simple rule, though:

If the compiler generates a warning, you are doing it wrong.

The above expression would normally generate two warnings telling you that the methods -setstringValue: and StringValue do not exist. Make the warnings go away properly and the problem would be resolved.

The compiler's error and warning messages are often a bit obtuse, but it really is trying to help by pointing out code that is very unlikely to work at runtime.

b.bum

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >Re: NSString help! (From: Omar Qazi <email@hidden>)

  • Prev by Date: NSTrackingArea message lag
  • Next by Date: [NSOutlineView] Saving/Restoring the hierarchy disclosure state (Reloaded)
  • Previous by thread: Re: NSString help!
  • Next by thread: [NSMutableAttributedString] How is NSBaseURLDocumentOption supposed to work?
  • Index(es):
    • Date
    • Thread