Xcode6 Constrain to margins
来源:互联网 发布:沪港通资金流向 软件 编辑:程序博客网 时间:2024/05/18 11:45
Xcode6多了个内边距, Constrain to margins
在stack overflow上边看到了一个帖子:楼主的约束莫名多了16像素空隙。
一下是一些回复:
In iOS 8 you now have the option to define your constrains relative to a predefined margin to the superview's bounds, instead of the superview's bounds themselves. Yes, it is totally related to the layout margins you pointed to in the docs. One advantage is that you may redefine your margins dynamically, or differently for each kind of device, and the layout will be updated correspondingly without modifying the constraints.When to use it: when you want to take advantage of this new flexibility.When to NOT use it: for any app targeted to run on iOS 7 or below.
这个是从官方文档上考下来的,意思是说iOS8默认多了个margin,你可以通过设置margin来控制默认的缝隙。
另一个回复直接给出了属性:
The property on UIView is: layoutMargins. See the Apple Docs. Basically if the layout margins are 8,8,8,8 (the default), a constraint with 0 leading space to container margin will have an x position of 8. Note that this is only available on iOS8 or later.For everyone who doesn't want their constraints to go to the container margin:CTRL+click+drag to show the constraint creation popup.If the menu shows to create the constraint to the margin by default, hold down option/alt to allow the constraint to be made to the container and not the container margin.Now it will show the option to create the constraint NOT to the margin. This is WAY faster in my usage.
iOS8在UIView中添加了新的属性:
/* -layoutMargins returns a set of insets from the edge of the view's bounds that denote a default spacing for laying out content. If preservesSuperviewLayoutMargins is YES, margins cascade down the view tree, adjusting for geometry offsets, so that setting the left value of layoutMargins on a superview will affect the left value of layoutMargins for subviews positioned close to the left edge of their superview's bounds If your view subclass uses layoutMargins in its layout or drawing, override -layoutMarginsDidChange in order to refresh your view if the margins change. */@property (nonatomic) UIEdgeInsets layoutMargins NS_AVAILABLE_IOS(8_0);@property (nonatomic) BOOL preservesSuperviewLayoutMargins NS_AVAILABLE_IOS(8_0); // default is NO - set to enable pass-through or cascading behavior of margins from this view’s parent to its children- (void)layoutMarginsDidChange NS_AVAILABLE_IOS(8_0);
0 0
- Xcode6 Constrain to margins
- 62.在设置autolayout时候 constrain to margins 和 Update Frames 这两项是什么意思?
- The Definitive Guide to Using Negative Margins
- PowerDesigner中"Reference constrain name maximum length is limited to 30 characters"问题
- textview constrain count
- Collapsing Margins
- Collapsing margins
- Collapsing Margins
- xcode6
- xcode6
- Margins and Long Lines
- iOS8 Layout Margins 详解
- css collapsing margins问题
- Size, Padding and Margins
- 如何drop有default constrain…
- 安装xcode6.0.1出错"xcode failed to download",解决办法
- Xcode6:No architectures to compile for(ONLY_ACTIVE_ARCH=YES...)
- xcode6错误提醒:Failed to code sign "某某Tests".
- 使用IntentService给自己的Android应用写一个文件下载器。
- 观察者模式
- LinuxC学习之函数指针与指针函数的简单区分与应用
- 疯狂Android讲义-2版-记录
- 域名访问Web网站过程
- Xcode6 Constrain to margins
- Ground Truth
- Perl文件及目录操作
- Python 正则表达式从CSV文件提取特定列
- ECShop后台管理菜单修改
- Git for Winodws 中文乱码情况提出了相应的解决方案
- 叶子形状的loading
- 总结----意大利葡萄酒种类识别
- Unity3D教程:制作与载入AssetBundle[转]