I'm a newbie in XCode programming. I have following code:
CGSize firstSize = CGSizeMake(1.0,1.0);
NSLog(@"[height] %@", firstSize.height);
//...
At runtime, I got the result:
height (null)
Could someone help me to explain while that code print null for firstSize.height?
Many thanks
Use %f
instead of %@
:
CGSize firstSize = CGSizeMake(1.0,1.0);
NSLog(@"[height] %f", firstSize.height);
%@
is used for all objects, here you are dealing with Core its float type, you need to use %f
for float.
If you want decimal precision as well, use %.2f
for 2 decimal digits.