NSString *latitude = [[NSString alloc] initWithFormat:@"%g°", coordinate.latitude]; NSString *longitude = [[NSString alloc] initWithFormat:@"%g°", coordinate.longitude]; self.pointLabel.text = [latitude stringByAppendingString:@", "]; self.pointLabel.text = [self.pointLabel.text stringByAppendingString:longitude]; - NSString* latitude = [[NSNumber numberWithDouble:coordinate.latitude] stringValue]; // this will not leak as yours does.kent– kent2009-07-09 16:56:03 +00:00Commented Jul 9, 2009 at 16:56
Add a comment |
4 Answers
self.pointLabel.text = [NSString stringWithFormat:@"%gº, %gº", coordinate.latitude, coordinate.longitude]; 2 Comments
Marshall Moutenot
what is that symbol after the g?
Dave DeLong
@MarshallMoutenot option-0. It's the masculine ordinal indicator. It would probably be better to use shift-cmd-8, which is the actual degree sign.
In addition to what the other three said, your code is leaking two objects. Please review the memory management rules.