initWithFormat: is a - method, so you call it on an instance. There is a corresponding stringWithFormat: method that is a + method, called on the class. You'd pass this to NSString like your second example, and you'd get a pointer to an autoreleased Object back.Ok I think I got it, but if I init a string with something I have to use alloc like this?Code:NSString * string = [[NSString alloc] initWithFormat:@"'%@' has %d characters.",textViewString,[textViewString length] ];
So I can't do like this?
Code:NSString * string = [NSString initWithFormat:@"'%@' has %d characters.",textViewString,[textViewString length] ];
Thanks for answering my questions! When I clear things I advance in my book again.
And you're welcome.
-Lee