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

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

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

      Swift 安全区域布局指南和可视化格式语言

      Swift Safe Area Layout Guide and Visual Format Language(Swift 安全区域布局指南和可视化格式语言)
    1. <legend id='6mz7F'><style id='6mz7F'><dir id='6mz7F'><q id='6mz7F'></q></dir></style></legend>
        <tbody id='6mz7F'></tbody>

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

                <bdo id='6mz7F'></bdo><ul id='6mz7F'></ul>

                <small id='6mz7F'></small><noframes id='6mz7F'>

              • <tfoot id='6mz7F'></tfoot>
                本文介绍了Swift 安全区域布局指南和可视化格式语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我想使用 Apple 的视觉格式语言将视图限制为新的 SafeiOS 11 中的区域布局指南.但是,我得到一个例外:

                I want to use Apples visual format language to constrain a view to the new Safe Area Layout Guide in iOS 11. However, I get an exception:

                -[NSLayoutYAxisAnchor nsli_superitem]:无法识别的选择器发送到实例 0x1c447ed40

                -[NSLayoutYAxisAnchor nsli_superitem]: unrecognized selector sent to instance 0x1c447ed40

                    //Make View Dictionary
                    var views: [String: Any] = ["left": self.leftContainer]
                
                    //Check swift version and add appropriate piece to the view dictionary
                    if #available(iOS 11, *) {
                        views["topGuide"] = self.view.safeAreaLayoutGuide.topAnchor
                    }else{
                        views["topGuide"] = self.topLayoutGuide
                    }
                
                    //Make the constraint using visual format language
                    let leftVertical = NSLayoutConstraint.constraints(withVisualFormat: "V:[topGuide][left]|", options: [], metrics: nil, views: views)
                
                    //Add the new constraint
                    self.view.addConstraints(vertical)
                

                我喜欢可视化格式语言的原因是因为在某些情况下你可以用更少的代码添加很多约束.

                The reason I like visual format language is because you a can add lot of constraints with less code in some cases.

                有什么想法吗?

                推荐答案

                我想使用 Apple 的视觉格式语言将视图约束到新的安全区域布局指南

                I want to use Apples visual format language to constrain a view to the new Safe Area Layout Guide

                你不能.无法通过视觉格式语言访问安全区域布局指南.我已经提交了一个错误,我建议你也这样做.

                You can't. There is no access to the safe area layout guide through the visual format language. I've filed a bug on this, and I suggest you do the same.

                这篇关于Swift 安全区域布局指南和可视化格式语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                iOS AutoLayout - get frame size width(iOS AutoLayout - 获取帧大小宽度)
                How to resize superview to fit all subviews with autolayout?(如何调整超级视图的大小以适应所有具有自动布局的子视图?)
                reloadData() of UITableView with Dynamic cell heights causes jumpy scrolling(具有动态单元格高度的 UITableView 的 reloadData() 导致跳跃滚动)
                How do I size a UITextView to its content?(如何根据内容调整 UITextView 的大小?)
                How to format localised strings in Swift?(如何在 Swift 中格式化本地化字符串?)
                Why do we need to set delegate to self? Why isn#39;t it defaulted by the compiler?(为什么我们需要将委托设置为自我?为什么编译器不默认它?)

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

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

                            <tbody id='Mw62b'></tbody>