相对于父视图的底部定位UIView? [英] Position a UIView relative to the bottom of the parent view?

查看:390
本文介绍了相对于父视图的底部定位UIView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将UIView对齐到父级的底部,以便框架的Y坐标相对于屏幕底部而不是顶部?

How can I align a UIView to the bottom of the parent so that the Y coordinate of the frame is relative to the bottom of the screen instead of the top?

这相当于在HTML中设置.bottom属性。

This would be the equivalent to setting the .bottom property in HTML.

这是因为我想确保我的视图始终位于窗口的底部,而不管父级的高度。

This is because I want to make sure my view is always at the bottom of window regardless of the height of the parent.

推荐答案

通过设置框架初步定位视图后c $ c> property,调整其 autoresizingMask 以包含 UIViewAutoresizingFlexibleTopMargin 。这将使其保持在超级视图的底部。

Once you have initially positioned the view by setting its frame property, adjust its autoresizingMask to include UIViewAutoresizingFlexibleTopMargin. That will keep it anchored to the bottom of its superview.

这篇关于相对于父视图的底部定位UIView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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