Detecting the coordinates on an object and outputting them to the NSLog
How exactly would I detect the coordinates of an object, such as a view named "content", and output this to the log? Thank开发者_如何学JAVAs for your help!
You can also do
NSLog(@"position: %@",NSStringFromCGPoint(object.center))
or.. what sometimes is more interesting the frame coordinates:
NSLog(@"frame: %@",NSStringFromCGRect(object.frame))
You could use:
NSLog(@"Object.x: %f, Object.y: %f", CGRectGetMinX(object.frame), CGRectGetMinY(object.frame));
Alternatively, you can get the center like so:
NSLog(@"Object.x: %f, Object.y: %f", object.center.x, object.center.y);
精彩评论