Gab*_*lla 55
假设您正在谈论UIView,您可能需要查看CGGeometry参考.
谈论'左'和y坐标没有多大意义,但是例如
CGRectGetMaxY(view.frame) // will return the bottommost y coordinate of the view
CGRectGetMinX(view.frame) // will return the leftmost x coordinate of the view
Run Code Online (Sandbox Code Playgroud)
等等.你明白了.
在Swift中,这样做更方便
view.frame.maxY // will return the bottommost y coordinate of the view
view.frame.minX // will return the leftmost x coordinate of the view
Run Code Online (Sandbox Code Playgroud)
Sea*_*anT 13
这取决于你想要参考的坐标.如果你想在视图的超级视图中使用左下角坐标,你可以得到左边和底部:
view.frame.origin.x 对于左坐标
和
view.frame.origin.y + view.frame.size.height 对于底部坐标