objective-c description method
Posted
by rocity
on Stack Overflow
See other posts from Stack Overflow
or by rocity
Published on 2010-06-09T01:19:37Z
Indexed on
2010/06/09
1:22 UTC
Read the original article
Hit count: 315
Maybe I'm stupid...and this is my first question so forgive me...but when I run this code, I get the following output:
(FROG idle:0 animating:0 rect:(null) position:{{1,2}{3,4}} tongue:{5,6})
This is wrong because it seems to be skipping the rect format string and placing everything displaced by one. So idle and animating are what i expect, then rect is skipped, but the result from NSStringFromCGRect(self.rect) is placed into position, then the result for position is pushed to tongue, then tongue is not displayed at all.
I'm at a loss.
- (NSString *)description{
return [NSString stringWithFormat:@"(FROG idle:%i animating:%i rect:%@ position:%@ tongue:%@)",
self.idleTime,
self.animating,
NSStringFromCGRect(self.rect),
NSStringFromCGPoint(self.position),
tongue
];
}
© Stack Overflow or respective owner