Is there a method can convert a BOOL into NSString in objective-C?
for example:
BOOL a = YES;
NSLog(@"a is %i",a);
but the output is "a is 1", I want it to print YES.
You can use the conditional operator to return string from the boolean.
BOOL a = YES;
NSLog(@"a is %@", a ? @"YES" : @"NO");
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