I have a class and I want to setup what is printed when I call NSLog with that class. For example,
NSLog(@"%@",nonstandardObject);
How do I setup the object so it prints out what I'd want?
Override the -description
method. It takes no parameters and returns an NSString
that get's printf
'd out.
There's another variant called -debugDescription
(returns NSString
, no parameters) that's used when po'ing the object from gdb.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With