In short, this method returns a string that represents the content of the receiving class, by default it is something like this:
<Card: 0x4b64c90>
Sounds mysterious for now, but when you override this method in your class (Card in this example), and make it look like this (face and value are properties of Card class):- (NSString *) description {
return [NSString stringWithFormat: @"face: %@, value: %d", self.face, self.value];
}
And then, in debugger, select Print / Description on the Card object:NSLog(@"Card: %@", card);
Similar to the debugger Print / Description command, you'll see your object description in console when the NSLog will be reached in code.
dzięki przyda się, niby proste ale nigdy nie chciało mi się sprawdzić
ReplyDelete