<legend id='2Vuck'><style id='2Vuck'><dir id='2Vuck'><q id='2Vuck'></q></dir></style></legend>
        <bdo id='2Vuck'></bdo><ul id='2Vuck'></ul>

      <small id='2Vuck'></small><noframes id='2Vuck'>

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

        <tfoot id='2Vuck'></tfoot>

        iOS 等效于 Android View.GONE 可见性模式

        iOS equivalent for Android View.GONE visibility mode(iOS 等效于 Android View.GONE 可见性模式)

      1. <tfoot id='tzNUa'></tfoot>
          <tbody id='tzNUa'></tbody>
      2. <legend id='tzNUa'><style id='tzNUa'><dir id='tzNUa'><q id='tzNUa'></q></dir></style></legend>

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

                <bdo id='tzNUa'></bdo><ul id='tzNUa'></ul>

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

                • 本文介绍了iOS 等效于 Android View.GONE 可见性模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在为 iOS 开发一个应用程序,并且我正在使用启用了 AutoLayout 的 Storyboard.我的一个视图控制器有一组 4 个按钮,在某些情况下我想让第一个按钮消失.

                  I'm developing an app for iOS and I'm using the Storyboard with AutoLayout ON. One of my view controllers has a set of 4 buttons, and in certain circumstances i would like to make the first one disappear.

                  如果我使用 setHidden:TRUE 方法,UIButton 会变得不可见,但它显然仍会在视图中占用空间,结果是一个我无法填充的洞"剩余的 UIButton 浮动到主视图的顶部.

                  If I use the setHidden:TRUE method the UIButton become invisible but it still obviously take space in the view, and the result is an "hole" which I've not been able to fill making the remaining UIButton to float towards the top of the main view.

                  在 Android 中,我会简单地使用 View.GONE 而不是 View.INVISIBLE,但在 iOS 中,我会坚持这种行为,我不想这样做相信唯一的解决方案是手动(是的,我的意思是以编程方式)将剩余的元素移动到顶部.

                  In Android I would have simply used View.GONE instead of View.INVISIBLE, but in iOS I'm stuck with this behaviour and I don't want to believe that the only solution is to manually (yes I mean programmatically) move the remaining elements to the top.

                  我以为我可以通过设置某种约束来让一切都像在 Android 中一样自动化,但我没有运气.

                  I thought I would have been able to do it setting some sort of Constraint to make everything as automatic as it is in Android but I've had no luck.

                  在我关闭自动布局之前,有人可以指出正确的方向吗?

                  Before I turn Autolayout OFF, can someone point me to the right direction?

                  我正在使用 IB,但我也对程序化的东西感到满意.

                  I'm using the IB, but I'm comfortable with programmatic stuff as well.

                  更新:

                  将组件高度设置为 0 也无济于事.

                  Setting the component height to 0 doesn't help as well.

                  我尝试过这样的事情:

                  UIButton *b;
                  CGRect frameRect = b.frame;
                  frameRect.size.height = 0;
                  b.frame = frameRect;
                  

                  推荐答案

                  添加一个将视图高度设置为 0 的约束(NSLayoutAttributeHeight)对我有用:

                  Adding a constraint(NSLayoutAttributeHeight) that sets height of the view to 0 worked for me:

                  [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.captchaView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:0]];
                  

                  这篇关于iOS 等效于 Android View.GONE 可见性模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

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

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

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

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

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