如果在iPad上启动,iOS如何确定应用自动调整大小蒙版? [英] How does iOS determine to apply the autoresizing masks if launched on iPad?

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

问题描述

我不知道如何正确解释我的问题,但如果有人理解它,将不胜感激,否则可以删除此问题.

我正在制作一个通用应用程序,我想知道:我在 loadView 中编写的代码我写了iPhone点(320、480)中指定的组件的位置.从下面的文档中可以看出,自动调整大小是对其超级视图被移动或调整大小的反应.所以我的问题是,在iPad上运行时,代码/视图如何知道如何自动调整大小?因为,超级视图(即self.view)是否真正调整了大小?

I am making an universal application I wonder: The code I write in loadView I write positions of components specified in a iPhone points (320, 480). And from the documentation below it says that autoresizing is a response to their superview being moved or resized. So my question is how does the code/views know to autoresize when runned on a iPad? Because, are the superview (which is self.view) really resized?

即使您使用自动调整大小的蒙版,您在loadView外部编写并附加到self.view以及iPhone位置(320、480)的代码也不会自动调整大小.

Code you write outside of loadView and attaches to self.view and with iPhone positions (320, 480) are not automatically resized even though you use autoresizing masks.

我知道这是针对Mac OSX的,但是:(引自 Mac OSX文档)

I know this is for Mac OSX but: (Quote from Mac OSX Documentation)

自动调整子视图NSView的大小提供自动机制在中移动和调整子视图的大小回应他们的监督移动或调整大小.在很多情况下,配置自动调整大小掩码一个视图提供了适当的应用程序的行为.默认情况下,自动调整大小功能处于开启状态以编程方式创建的视图,但是您可以使用关闭它setAutoresizesSubviews:方法.

Autoresizing of Subviews NSView provides a mechanism for automatically moving and resizing subviews in response to their superview being moved or resized. In many cases simply configuring the autoresizing mask for a view provides the appropriate behavior for an application. Autoresizing is on by default for views created programmatically, but you can turn it off using the setAutoresizesSubviews: method.

推荐答案

当以模态显示UIViewController或将其推送到UINavigationController,UITabBarController等上时,将调整其根视图的大小以适合相应的内容区域.所有子视图都会根据其自动调整大小蒙版进行调整.

When your UIViewController is presented modally or is pushed onto a UINavigationController, UITabBarController, or the like, its root view will be resized to fit the appropriate content area. Any subviews are resized according to their autoresizing masks.

您的代码在loadView之外"实际上会自动调整大小,但是(取决于执行此代码的确切时间)根视图可能已经调整了大小:将320像素宽的视图添加到320中是有区别的-px超级视图,然后将其调整为1024 px,而不是将320 px宽度的视图添加到已经为1024 px的超级视图中.

Your code "outside of loadView" actually will be resized automatically, but (depending on exactly when this code is executed) the root view may have already been resized: it's the difference between adding a 320-px width view into a 320-px superview and then resizing to 1024 px versus adding a 320-px width view into a superview that is already 1024 px.

这篇关于如果在iPad上启动,iOS如何确定应用自动调整大小蒙版?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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