开发者

Ensuring Orientation of UIView subviews

开发者 https://www.devze.com 2023-01-12 00:57 出处:网络
I have a UIView that will eventually contain a child, another UIView. What I would like to do is ensure that the child is always oriented in the lower left corner of the screen, regardless of orient

I have a UIView that will eventually contain a child, another UIView.

What I would like to do is ensure that the child is always oriented in the lower left corner of the screen, regardless of orientation. If I add the view at position (0, 0), the subview will remain in the top left corner, regardless of orientation. My question is, how can I get my subview to remain in the lower left corner?

What parameters / autoresizing masks, etc. must I specify when I create the vie开发者_如何学JAVAw to get this to happen?

Thanks.


Position the child view in the bottom left corner and configure its autoresizingMask property. I've always used Interface Builder to do this for me, so I'm not sure which ones you want to set programmatically, probably something like:

View.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin |UIViewAutoresizingFlexibleLeftMargin;

Here is the documentation for the autoresizing values.

0

精彩评论

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