Hey guys,
I could use some insight in the following code..
So... A user types a message in the textField and when he clicks count, labelField shows a message with his original message and tells him the number of characters in the message. Very straight forward ( this is a challenge example from the book cocoa programming for os x that I am going through right now ).
What I'd like to know is if anyone would implement this differently.
I could use some insight in the following code..
Code:
- (IBAction)count:(id)sender
{
NSString *string = [[NSString alloc] initWithString:[textField stringValue]];
int i = [string length];
[labelField setStringValue:[NSString stringWithFormat:@"%@ has %d numbers",string, i]];
[string release];
}
So... A user types a message in the textField and when he clicks count, labelField shows a message with his original message and tells him the number of characters in the message. Very straight forward ( this is a challenge example from the book cocoa programming for os x that I am going through right now ).
What I'd like to know is if anyone would implement this differently.