<legend id='97ypi'><style id='97ypi'><dir id='97ypi'><q id='97ypi'></q></dir></style></legend>
    • <bdo id='97ypi'></bdo><ul id='97ypi'></ul>
  • <small id='97ypi'></small><noframes id='97ypi'>

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

        <tfoot id='97ypi'></tfoot>

        自动布局约束:如何使视图在调整大小时保持其宽度/高度比?

        Auto-Layout Constraint: How to make a view maintains its width/height ratio when resized?(自动布局约束:如何使视图在调整大小时保持其宽度/高度比?)
        <i id='RMVuk'><tr id='RMVuk'><dt id='RMVuk'><q id='RMVuk'><span id='RMVuk'><b id='RMVuk'><form id='RMVuk'><ins id='RMVuk'></ins><ul id='RMVuk'></ul><sub id='RMVuk'></sub></form><legend id='RMVuk'></legend><bdo id='RMVuk'><pre id='RMVuk'><center id='RMVuk'></center></pre></bdo></b><th id='RMVuk'></th></span></q></dt></tr></i><div id='RMVuk'><tfoot id='RMVuk'></tfoot><dl id='RMVuk'><fieldset id='RMVuk'></fieldset></dl></div>
          <tbody id='RMVuk'></tbody>

      1. <small id='RMVuk'></small><noframes id='RMVuk'>

        • <bdo id='RMVuk'></bdo><ul id='RMVuk'></ul>
        • <tfoot id='RMVuk'></tfoot>
          • <legend id='RMVuk'><style id='RMVuk'><dir id='RMVuk'><q id='RMVuk'></q></dir></style></legend>

                1. 本文介绍了自动布局约束:如何使视图在调整大小时保持其宽度/高度比?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在界面构建器中,我们可以固定高度、固定宽度,使两个视图的宽度相等,但是如何设置约束,以便在调整视图大小时,它保持其宽度/高度比?

                  In the interface builder we can pin height, pin width, make two views width equally, but how do I set the constraints so that when a view is being resized, it maintains its width/height ratio?

                  在我的特殊情况下,我的视图控制器中有一个 UIImageView.当视图调整大小时,我希望我的图像视图调整大小,但保持 3:2 的宽度:高度比.是否可以在 IB 中完成?用代码可以吗?

                  In my particular case, I have an UIImageView in my view controller. When the view resizes, I'd like my image view to resize, but maintain a 3:2 width:height ratio. Is it possible to do it in IB? Is it possible to do it with code?

                  谢谢!

                  推荐答案

                  您可以在 IB 中通过控件从视图拖动到自身并选择纵横比来添加纵横比约束.

                  You can add an aspect ratio constraint in IB by control dragging from the view to itself and choosing aspect ratio.

                  这篇关于自动布局约束:如何使视图在调整大小时保持其宽度/高度比?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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屋-程序员
                2. <small id='PLLNZ'></small><noframes id='PLLNZ'>

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

                    <bdo id='PLLNZ'></bdo><ul id='PLLNZ'></ul>
                    • <tfoot id='PLLNZ'></tfoot>

                            <tbody id='PLLNZ'></tbody>