I cannot understand why the date is never set in the title - it's always ignored and if I swap around the date and the title, then the title is ignored!
-(id)initWithCoordinate:(开发者_Go百科CLLocationCoordinate2D)c title:(NSString *)t
{
[super init];
coordinate = c;
NSDate *today = [NSDate date];
[self setTitle:(@"%@%@", [today description], t)];
//[today release];
return self;
}
You want:
[self setTitle:[NSString stringWithFormat:@"%@%@", [today description], t]];
Your version isn't building a new string, it's just listing three, of which the last one is used. That's the behaviour of a bunch of expressions in brackets separated by commas like this in C.
精彩评论