2
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]; 
1
  • NSString* latitude = [[NSNumber numberWithDouble:coordinate.latitude] stringValue]; // this will not leak as yours does. Commented Jul 9, 2009 at 16:56

4 Answers 4

12
self.pointLabel.text = [NSString stringWithFormat:@"%gº, %gº", coordinate.latitude, coordinate.longitude]; 
Sign up to request clarification or add additional context in comments.

2 Comments

what is that symbol after the g?
@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.
3

Yes. Vote for me ;)

self.pointLabel.text = [NSString stringWithFormat @"%g°, %g°", coordinate.latitude, coordinate.longitude]; 

Comments

2

Yep.

self.pointLabel.text = [NSString stringWithFormat @"%g°, %g°", coordinate.latitude, coordinate.longitude]; 

Comments

2

In addition to what the other three said, your code is leaking two objects. Please review the memory management rules.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.