简体   繁体   English

iOS控件坐标

[英]iOS Controls coordinates

Is it possible to find out right or bottom coordinate of some child control inside some UIView? 是否可以在某个UIView中找出某个子控件的右坐标或底坐标? One way of doing this for rightmost x coordinate of control is by adding control's frame.size.width + frame.origin.x . 对控件的最右x坐标执行此操作的一种方法是通过添加控件的frame.size.width + frame.origin.x

I think I've read somewhere that this value is available as property, not sure where, maybe in some framework.. 我想我读过某个地方,该值可以作为属性使用,不确定在某些框架中的位置。

you can use CGRectGetMaxX(view.frame) , CGRectGetMaxY(view.frame) 您可以使用CGRectGetMaxX(view.frame)CGRectGetMaxY(view.frame)

to get the right-bottom co-ordinate, you could also use Core Graphics methods like 为了获得右下角的坐标,您还可以使用Core Graphics方法,例如

CGRectGetMinX and CGRectGetMinY .. etc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM