Layout attributes relative to the layout margin on iOS versions prior to 8.0

前端 未结 7 2147
[愿得一人]
[愿得一人] 2020-12-02 12:12

What would be causing the following warning (and subsequent alignment issues on iOS 7)?

Attribute Unavailable: Layout attributes relative to the layou

7条回答
  •  隐瞒了意图╮
    2020-12-02 12:48

    Unchecking the "Prefer Margin Relative" checkbox will keep you from getting into the situation where you get this warning.

    If you are like me and you built an entire app with constraints before realizing the problem, then things are a bit tougher because Xcode will not easily tell you which constraints are a problem.

    In order to avoid rebuilding all of my constraints, I resorted to looking at the actual .storyboard file and I looked for constraints like this:

    
    

    Notice "topMargin". The attributes ending in "Margin" cause the warning. I went through and identified the constraints in the file this way, then I removed and re-created them in IB. After that, this warning went away.

    I suspect this should also resolve some inconsistencies between iOS 7 and iOS 8 constraint handling, although I am still encountering some differences in behavior, even after addressing all Xcode warnings.

提交回复
热议问题