Skip to content

Instantly share code, notes, and snippets.

@matthewhudson
Created March 22, 2012 19:53
Show Gist options
  • Save matthewhudson/2162865 to your computer and use it in GitHub Desktop.
Save matthewhudson/2162865 to your computer and use it in GitHub Desktop.
Cocoa NSLog() Frame & Bounds
// The bounds of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to its own coordinate system (0,0).
NSLog(@"bounds.origin.x: %f", thing.bounds.origin.x);
NSLog(@"bounds.origin.y: %f", thing.bounds.origin.y);
NSLog(@"bounds.size.width: %f", thing.bounds.size.width);
NSLog(@"bounds.size.height: %f", thing.bounds.size.height);
// The frame of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to the superview it is contained within.
NSLog(@"frame.origin.x: %f", thing.frame.origin.x);
NSLog(@"frame.origin.y: %f", thing.frame.origin.y);
NSLog(@"frame.size.width: %f", thing.frame.size.width);
NSLog(@"frame.size.height: %f", thing.frame.size.height);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment