Prevent Interface Builder from auto creating Constraints?

后端 未结 2 1377
忘掉有多难
忘掉有多难 2021-01-18 03:20

I created a demo project here. I have a view where I created a ScrollView in a .xib file. In interface builder I did not set any constraints. In my viewDidLoad method I set

2条回答
  •  旧巷少年郎
    2021-01-18 03:35

    If you are confused about the NSAutoresizingMaskLayoutConstraints in that list, it might be because you haven't called setTranslatesAutoresizingMasksIntoContraints(false) on that view. (although, I was under the impression that SnapKit does that for you).

    If you are confused about the NSIBPrototypingLayoutConstraint, that's an auto-generated constraint by Interface Builder. To get rid of it, add some Top, Bottom, Leading and Trailing constraints in Interface Builder and set them to be removed at build time. For more details about that, have a look at http://travisjeffery.com/b/2013/11/preventing-ib-auto-generated-at-build-time-for-view-with-fixed-frame/

    UPDATE: url was changed to http://travisjeffery.com/b/2013/11/preventing-ib-auto-generated-at-build-time-for-view-with-fixed-frame-when-using-auto-layout/

提交回复
热议问题