开发者

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜