Autoresizing masks programmatically vs Interface Builder / xib / nib(以编程方式自动调整掩码与 Interface Builder/xib/nib)
问题描述
我有一个(可能是错误的)假设,即在 xib 中启用右边距指示器等同于在代码中使用 UIViewAutoresizingFlexibleLeftMargin 等等.
I was in an (probably false) assumption that enabling the right margin indicator in xib is equivalent to using UIViewAutoresizingFlexibleLeftMargin inside code and so on.
所以,我曾经根据这个快照思考:
So, I used to think according to this snapshot:
今天晚些时候,我不得不交叉检查,偶然发现 这个帖子.
Later today I had to cross check, and stumbled upon this thread.
还有苹果文档,标题为使用自动调整规则自动处理布局更改"的部分:https://developer.apple.com/library/content/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/CreatingViews/CreatingViews.html
And also the apple documentation, entitled with the section with title - "Handling Layout Changes Automatically Using Autoresizing Rules" in this link: https://developer.apple.com/library/content/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/CreatingViews/CreatingViews.html
所以我现在有了一个新的概念,即以编程方式设置自动调整大小掩码如何等同于 xib 设置:
So I now have a renewed concept in my mind as to how setting autoresizing masks programmatically would be equivalent to xib settings:
场景 1:仅设置 (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight) 相当于:
在 XIB 中?
场景 2:在代码中设置 (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin) 相当于:
Scenario 2:
Setting (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin) in code is equivalent to:
在 XIB 中?
我的 2 个更新的场景是否正确?我现在在我的理解中吗?
Are my 2 renewed scenarios correct? Am I right now in my understanding?
推荐答案
是的,Interface Builder 在某种意义上把它颠倒了"(或者 UIView,取决于你如何看待它).您引用的场景"是正确的.
Yes, Interface Builder has it "reversed" in a sense (or UIView, depending on how you look at it). Your cited "scenarios" are correct.
这篇关于以编程方式自动调整掩码与 Interface Builder/xib/nib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:以编程方式自动调整掩码与 Interface Builder/xib/nib
基础教程推荐
- NSString intValue 不能用于检索电话号码 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
