如何获得底部y坐标 [英] How get bottom y coordinate

查看:112
本文介绍了如何获得底部y坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获得obj-c和Swift中视图的左下角坐标,即最大y坐标?

How can I get the bottom left coordinate, i.e. the maximum y coordinate, of a view in obj-c and Swift?

推荐答案

假设您正在谈论 UIView ,您可能需要查看 CGGeometry 参考。

Supposing that you're talking about UIView, you may want to look at the CGGeometry reference.

谈论'左'和y坐标没有多大意义,但是例如

Talking about 'left' and y coordinate doesn't make much sense, but for instance

CGRectGetMaxY(view.frame) // will return the bottommost y coordinate of the view
CGRectGetMinX(view.frame) // will return the leftmost x coordinate of the view

依此类推。你明白了。

在Swift中,这更方便,你可以做到这一点

In Swift, this is even more convenient, as you can do

view.frame.maxY
view.frame.minY

这篇关于如何获得底部y坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆