How to disable “Relative to margin” option for newly created constraint in Xcode6

China☆狼群 提交于 2019-12-20 16:21:08

问题


I want to disable automatic adding Relative to margin when creating constraints in IB of Xcode 6.

It's nice that they turn this option on by default, but I have to support iOS7, so it turned out I have to manually disable this option every time after adding new constraint.

I found this setting for disabling it beforehand, but it's always on by default.


回答1:


This plugin will set a default value of Constrain to margins to disabled.

https://github.com/mshibanami/DefaultMarginDisabler




回答2:


The closest I've ever come to this is hacky at best, so take this for what it is...

Creating AL constraint while not holding Option:

Creating AL constraint while holding option:

In IB if you hold Option while creating the AL constraint, it toggles whether the constraint binds to a margin or not. That's one convenient way to avoid re-editing the constraint. Further (and this is the hacky part because I can't explain it) I've noticed that in projects where I start holding option and binding AL constraints without the margin, that behavior becomes the default!

Like I said, it's hacky and I can't explain it why the default changes sometimes, but holding Option when you create constraints is the closest I've ever gotten.




回答3:


It is by default enabled in storyboards, I have not found how to disable it. But in Xibs, it is unchecked when you create a constraint. A solution may be to create a storyboard that instantiates your xibs, but you will loose every possibilities given by the segues.

So You may want to deal with it since there's no option for that (so far... ?).



来源:https://stackoverflow.com/questions/26092963/how-to-disable-relative-to-margin-option-for-newly-created-constraint-in-xcode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!