If I want to print two values using an Objective-C dot operator with the NSLog statement, I would do it like so:
NSLog(@"The height is %i and the width is %i", myRect.height, myRect.width);
But is there any way in which I can list the height and width only metioning myRect once? After all, they’re from the the same object and class. Is there some sort of shorthand like so?
NSLog(@"The height is %i and the width is %i", myRect.height, width);
PS. I know that the above code doesn’t work, but am I missing something that would work similar to the code above?
No, there’s no shorthand.
Unspoken convention when accessing many fields from one object could be using really short names for the local variable of the object, so you only get eg
r.width, r.height.