Take the line
[angleLabelInRadians setText:[[NSString alloc] initWithFormat:@"%.3g", [poly angleInRadians]]];
When creating an NSString object within a message, do I still need to release this NSString and, if so, how would I do that, given that I haven’t created a pointer to the object?
Furthermore, is this correct coding procedure, or is this line too long? Would it be better to split it up in the following form?
NSString *polyRad = [[NSString alloc] initWithFormat:@"%.3g", [poly angleInRadians]];
[angleLabelInRadians setText:polyRad];
[polyRad release];
Unless you’re in an enviornment without an autorelease pool, you’ll most often just go with one of the convenience functions to do the above.
If you do not want to use autoreleasing, you would have to do