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

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

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

        <bdo id='FTpUJ'></bdo><ul id='FTpUJ'></ul>
      <tfoot id='FTpUJ'></tfoot>
    2. 在使用自动布局下动画/移动视图

      Animating/Moving views under usage of Autolayout(在使用自动布局下动画/移动视图)

        <tbody id='maVRk'></tbody>
        <bdo id='maVRk'></bdo><ul id='maVRk'></ul>

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

              1. 本文介绍了在使用自动布局下动画/移动视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我想将视图从一个位置移动到另一个位置,我可以使用

                I want to move a view from one postion to another, I can implement it using

                self.view.center = CGPointMake(100, 200);
                

                但是,如果项目使用 Autolayout,那么运行后视图会回到原来的位置:

                however, if the project is using Autolayout, then the view will be back to original position after running:

                [self.view.superview setNeedsLayout];
                

                那么如何将视图实际移动到新位置?

                then how to actually move a view to new position?

                推荐答案

                如果使用 autoLayout,则必须更改约束.建议的方法是在约束的视图控制器中创建一个出口,然后更改约束的常量.如果你有时间,我肯定会推荐 去这里 并观看示例自动布局"或最佳实践"掌握自动布局".他们帮了我很多.我想要带走的一点是,使用自动布局,您不再考虑框架.因此,设置中心不适用于自动布局.关键在于视图之间如何相互关联.

                You must change the constraints if you are using autoLayout. The way that is suggested is to make an outlet in your view controller of the constraint, then you change the constant of the constraint. If you have the time i would definitely recommend going here and watching "Auto Layout by Example" or "Best Practices for Mastering Auto Layout". They helped me out a lot. I guess the point to take away is that with autoLayout, you no longer think in terms of frames. So setting the center just doesnt work with auto layout. It's all about how views are related to each other.

                这篇关于在使用自动布局下动画/移动视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                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屋-程序员

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

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

                            <tbody id='QeedF'></tbody>
                          <tfoot id='QeedF'></tfoot>