自动调整大小的蒙版何时在iOS中生效? [英] When do autoresizing masks take effect in iOS?

查看:83
本文介绍了自动调整大小的蒙版何时在iOS中生效?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个笔尖,最初是为iPhone应用程序创建的,尺寸为320x480,并设置了自动调整大小的蒙版,以在其超级视图很大时向各个方向扩展视图.

I have a nib that I originally created for an iPhone app with dimensions 320x480 and with autoresizing masks set up to expand the view in every direction should its superview be large.

我现在正在使我的应用通用,并使用相同的笔尖并将其显示在iPad的页面中.

I am now making my app universal, and am using the same nib and showing it in a page sheet on the iPad.

我的问题是我根据帧大小进行了一些计算,但仍然显示320x480.但是在其他方法中,框架大小可以正确显示为页面的大小.

My problem is that I make some calculations based on the frame size, which is still showing 320x480. But in other methods, the frame size is showing correctly as the size of the page sheet.

问题:自动调整大小蒙版何时生效,以便我可以在正确的时间进行计算?

Question: When do the autoresizing masks take effect so I can make my calculations at the correct time?

推荐答案

autoresizingMask属性在其父视图的框架更改时生效.超级视图属性resizesSubviews必须为YES.加载NIB时,将在NIB中设置超级视图的框架.您可以在初始化时将其设置为任意值.

The autoresizingMask property takes effect when the frame of it's superview changes. The superview property resizesSubviews must be YES. When you load your NIB, the superview's frame is set as in the NIB. You can set this to whatever you want while initializing.

这篇关于自动调整大小的蒙版何时在iOS中生效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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