UIView autoresizingMask问题 [英] UIView autoresizingMask problem

查看:114
本文介绍了UIView autoresizingMask问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iPad中。我有一个UIViewController,里面有另一个UIview,位于底部。

In iPad. I have a UIViewController with another UIview inside it, at the bottom.

 ____________
|            |
|            |
|   UIView   |
| Controller |
|            |
|            |
|         X  |
 ------------

UIView是X 。

The UIView is the X.

我在UIViewController的viewDidLoad上定义了这样的autoresizingMask

I define for it an autoresizingMask like this, on the viewDidLoad of the UIViewController

self.view.autoresizeSubviews = YES;

// xView creation

xView.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;

但这不起作用,xView旋转正常,但超出了横向屏幕界限。

But this doesn't works, the xView rotates fine but out of the screen bounds on landscape.

我缺少什么?

推荐答案

如果你想要视图在右下角,它应该有一个灵活的顶部边距。

If you want the view to be at lower-right corner, it should have a flexible left and top margin.

 xView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | 
                          UIViewAutoresizingFlexibleTopMargin;

这篇关于UIView autoresizingMask问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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