<tfoot id='j0yaO'></tfoot>

      • <bdo id='j0yaO'></bdo><ul id='j0yaO'></ul>

    1. <legend id='j0yaO'><style id='j0yaO'><dir id='j0yaO'><q id='j0yaO'></q></dir></style></legend>
      <i id='j0yaO'><tr id='j0yaO'><dt id='j0yaO'><q id='j0yaO'><span id='j0yaO'><b id='j0yaO'><form id='j0yaO'><ins id='j0yaO'></ins><ul id='j0yaO'></ul><sub id='j0yaO'></sub></form><legend id='j0yaO'></legend><bdo id='j0yaO'><pre id='j0yaO'><center id='j0yaO'></center></pre></bdo></b><th id='j0yaO'></th></span></q></dt></tr></i><div id='j0yaO'><tfoot id='j0yaO'></tfoot><dl id='j0yaO'><fieldset id='j0yaO'></fieldset></dl></div>
    2. <small id='j0yaO'></small><noframes id='j0yaO'>

    3. 防止 Interface Builder 自动创建约束?

      Prevent Interface Builder from auto creating Constraints?(防止 Interface Builder 自动创建约束?)

      <legend id='sjZGW'><style id='sjZGW'><dir id='sjZGW'><q id='sjZGW'></q></dir></style></legend>

        • <tfoot id='sjZGW'></tfoot>
              <tbody id='sjZGW'></tbody>

              <small id='sjZGW'></small><noframes id='sjZGW'>

              • <bdo id='sjZGW'></bdo><ul id='sjZGW'></ul>
                <i id='sjZGW'><tr id='sjZGW'><dt id='sjZGW'><q id='sjZGW'><span id='sjZGW'><b id='sjZGW'><form id='sjZGW'><ins id='sjZGW'></ins><ul id='sjZGW'></ul><sub id='sjZGW'></sub></form><legend id='sjZGW'></legend><bdo id='sjZGW'><pre id='sjZGW'><center id='sjZGW'></center></pre></bdo></b><th id='sjZGW'></th></span></q></dt></tr></i><div id='sjZGW'><tfoot id='sjZGW'></tfoot><dl id='sjZGW'><fieldset id='sjZGW'></fieldset></dl></div>
                本文介绍了防止 Interface Builder 自动创建约束?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我在这里创建了一个演示项目.我有一个视图,我在 .xib 文件中创建了一个 ScrollView.在界面生成器中,我没有设置任何约束.在我的 viewDidLoad 方法中,我使用 SnapKit 设置约束:

                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 constraints with SnapKit:

                scrollView.snp_makeConstraints { (make) -> Void in
                  make.edges.equalTo(self.view)
                }
                

                当我运行代码时,我得到以下控制台输出:

                When I run the code I get the following console output:

                Unable to simultaneously satisfy constraints.
                    Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
                (
                    "<NSIBPrototypingLayoutConstraint:0x7b74e280 'IB auto generated at build time for view with fixed frame' V:|-(1)-[UIScrollView:0x7b74c430]   (Names: '|':UIView:0x7b74dd10 )>",
                    "<<DeviceImagesTest.LayoutConstraint:0x7baa2760> <UIScrollView:0x7b6608d0>.top == <UIView:0x7b64d800>.top>"
                )
                
                Will attempt to recover by breaking constraint 
                <NSIBPrototypingLayoutConstraint:0x7b74e280 'IB auto generated at build time for view with fixed frame' V:|-(1)-[UIScrollView:0x7b74c430]   (Names: '|':UIView:0x7b74dd10 )>
                
                Break on objc_exception_throw to catch this in the debugger.
                The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
                2015-05-29 18:37:14.368 DeviceImagesTest[36462:607] Unable to simultaneously satisfy constraints.
                    Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
                (
                    "<NSIBPrototypingLayoutConstraint:0x7b74e080 'IB auto generated at build time for view with fixed frame' H:|-(0)-[UIScrollView:0x7b74c430](LTR)   (Names: '|':UIView:0x7b74dd10 )>",
                    "<NSIBPrototypingLayoutConstraint:0x7b74e330 'IB auto generated at build time for view with fixed frame' H:[UIScrollView:0x7b74c430(600)]>",
                    "<<DeviceImagesTest.LayoutConstraint:0x7baa7170> <UIScrollView:0x7baa7b30>.right == <UIView:0x7baa79a0>.right>",
                    "<NSAutoresizingMaskLayoutConstraint:0x7baa4800 h=-&- v=-&- UIView:0x7b74dd10.width == UIViewControllerWrapperView:0x7ba9f060.width>",
                    "<NSAutoresizingMaskLayoutConstraint:0x7baa5180 h=-&- v=-&- UIViewControllerWrapperView:0x7ba9f060.width == UINavigationTransitionView:0x7bc769b0.width>",
                    "<NSAutoresizingMaskLayoutConstraint:0x7baa58e0 h=-&- v=-&- UINavigationTransitionView:0x7bc769b0.width == UILayoutContainerView:0x7bc75140.width>",
                    "<NSAutoresizingMaskLayoutConstraint:0x7baa61a0 h=-&- v=-&- UILayoutContainerView:0x7bc75140.width == UIWindow:0x7bc71870.width>",
                    "<NSAutoresizingMaskLayoutConstraint:0x7baa69a0 h=--- v=--- H:[UIWindow:0x7bc71870(320)]>"
                )
                
                Will attempt to recover by breaking constraint 
                <<DeviceImagesTest.LayoutConstraint:0x7baa95b0> <UIScrollView:0x7baa9610>.right == <UIView:0x7baa96b0>.right>
                
                Break on objc_exception_throw to catch this in the debugger.
                The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
                2015-05-29 18:37:14.496 DeviceImagesTest[36462:607] Unable to simultaneously satisfy constraints.
                    Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
                (
                    "<NSIBPrototypingLayoutConstraint:0x7b74e360 'IB auto generated at build time for view with fixed frame' V:[UIScrollView:0x7b74c430(600)]>",
                    "<<DeviceImagesTest.LayoutConstraint:0x7bc77e40> <UIScrollView:0x7bc7f6a0>.top == <UIView:0x7bc52180>.top>",
                    "<<DeviceImagesTest.LayoutConstraint:0x7bc49420> <UIScrollView:0x7bc74b00>.bottom == <UIView:0x7bc7b970>.bottom>",
                    "<NSAutoresizingMaskLayoutConstraint:0x7baa4960 h=-&- v=-&- UIView:0x7b74dd10.height == UIViewControllerWrapperView:0x7ba9f060.height>",
                    "<NSAutoresizingMaskLayoutConstraint:0x7baa51e0 h=-&- v=-&- UIViewControllerWrapperView:0x7ba9f060.height == UINavigationTransitionView:0x7bc769b0.height>",
                    "<NSAutoresizingMaskLayoutConstraint:0x7baa5940 h=-&- v=-&- UINavigationTransitionView:0x7bc769b0.height == UILayoutContainerView:0x7bc75140.height>",
                    "<NSAutoresizingMaskLayoutConstraint:0x7baa6200 h=-&- v=-&- UILayoutContainerView:0x7bc75140.height == UIWindow:0x7bc71870.height>",
                    "<NSAutoresizingMaskLayoutConstraint:0x7baa69d0 h=--- v=--- V:[UIWindow:0x7bc71870(568)]>"
                )
                
                Will attempt to recover by breaking constraint 
                <<DeviceImagesTest.LayoutConstraint:0x7bc84790> <UIScrollView:0x7bc848b0>.bottom == <UIView:0x7bc84860>.bottom>
                
                Break on objc_exception_throw to catch this in the debugger.
                The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
                

                即使我没有设置任何约束,Interface Builder 似乎也在为我生成约束.这会导致与我在代码中设置的约束发生冲突.我还设置了 setTranslatesAutoresizingMasks(false).

                It seems that Interface Builder is generating Constraints for me even if I did not set any. This leads to a conflict with my constraints I set in code. I also set setTranslatesAutoresizingMasks(false).

                如何防止 Interface Builder 自动生成约束?

                推荐答案

                如果您对该列表中的 NSAutoresizingMaskLayoutConstraints 感到困惑,可能是因为您还没有调用 setTranslatesAutoresizingMasksIntoContraints(false)看法.(不过,我的印象是 SnapKit 会为你做到这一点).

                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).

                如果您对 NSIBPrototypingLayoutConstraint 感到困惑,那是 Interface Builder 自动生成的约束.要摆脱它,请在 Interface Builder 中添加一些 Top、Bottom、Leading 和 Trailing 约束,并将它们设置为在构建时删除.有关详细信息,请查看 http://travisjeffery.com/b/2013/11/preventing-ib-auto-generated-at-build-time-for-view-with-fixed-frame/

                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/

                更新:网址已更改为 http://travisjeffery.com/b/2013/11/preventing-ib-auto-generated-at-build-time-for-view-with-fixed-frame-when-using-auto-layout/

                这篇关于防止 Interface Builder 自动创建约束?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                iOS AutoLayout - get frame size width(iOS AutoLayout - 获取帧大小宽度)
                Auto layout constraints issue on iOS7 in UITableViewCell(UITableViewCell中iOS7上的自动布局约束问题)
                How to resize superview to fit all subviews with autolayout?(如何调整超级视图的大小以适应所有具有自动布局的子视图?)
                Springs in Auto Layout: Distribute views evenly, with constraints, in Xcode 5(自动布局中的弹簧:在 Xcode 5 中使用约束均匀分布视图)
                reloadData() of UITableView with Dynamic cell heights causes jumpy scrolling(具有动态单元格高度的 UITableView 的 reloadData() 导致跳跃滚动)
                What is NSLayoutConstraint quot;UIView-Encapsulated-Layout-Heightquot; and how should I go about forcing it to recalculate cleanly?(什么是 NSLayoutConstraint“UIView-Encapsulated-Layout-Height?我应该如何强制它干净地重新计算?) - IT屋-程序员
                  <bdo id='c5yg2'></bdo><ul id='c5yg2'></ul>

                  • <i id='c5yg2'><tr id='c5yg2'><dt id='c5yg2'><q id='c5yg2'><span id='c5yg2'><b id='c5yg2'><form id='c5yg2'><ins id='c5yg2'></ins><ul id='c5yg2'></ul><sub id='c5yg2'></sub></form><legend id='c5yg2'></legend><bdo id='c5yg2'><pre id='c5yg2'><center id='c5yg2'></center></pre></bdo></b><th id='c5yg2'></th></span></q></dt></tr></i><div id='c5yg2'><tfoot id='c5yg2'></tfoot><dl id='c5yg2'><fieldset id='c5yg2'></fieldset></dl></div>

                      1. <legend id='c5yg2'><style id='c5yg2'><dir id='c5yg2'><q id='c5yg2'></q></dir></style></legend>

                            <tbody id='c5yg2'></tbody>
                        1. <tfoot id='c5yg2'></tfoot>
                        2. <small id='c5yg2'></small><noframes id='c5yg2'>