Logging a Frame in iOS
It happens quite often that you need to log the dimensions of a frame in iOS (which is a CGRect struct). Because you need to log 4 different values, it’s quite clunky.
NSLog(@"Frame is {{%g, %g}, {%g, %g}}", frame.origin.x, frame.origin.y, frame.size.width, frame.size.height);
Turns out, there’s a much easier way.
NSLog(@"Frame is %@", NSStringFromCGRect(frame));
Happy coding.