Hello,
I'm trying to work through an exercise in the new Hillegass book and am
encountering difficulties. The app fails to build. The relevant code
snippet is below, with errors noted in the comments:
-(IBAction)getCount:(id)sender
{
NSString *string = [textField stringValue];
int *stringLength = [string length]; //warning: initialization makes
pointer from integer without a cast
[textLabel setStringValue:@"\"[EMAIL PROTECTED]" is %d characters long", string,
stringLength]; //error: too many arguments to function 'setStringValue:'
NSLog(@"%@", string);
}
The idea is to take input from a text field, calculate the number of
characters in the text string, and display both the entered text string
and the number of characters in a text label.
I'd appreciate it if someone could clarify two things for me:
1. How to structure the setStringValue method so that gcc doesn't barf
because of "too many arguments"--I'm not clear what that means.
2. How to structure the initialization of the stringLength variable so
that gcc doesn't emit warnings--I'm not clear on what the problem is here.
TIA,
Kevin
--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
_______________________________________________
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 [EMAIL PROTECTED]