• <small id='dQh3e'></small><noframes id='dQh3e'>

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

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

        iOS 控件像 android 一样隐藏和消失

        时间:2023-09-11
          <tbody id='5MTV7'></tbody>

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

          1. <tfoot id='5MTV7'></tfoot>
                  <bdo id='5MTV7'></bdo><ul id='5MTV7'></ul>
                • <small id='5MTV7'></small><noframes id='5MTV7'>

                • 本文介绍了iOS 控件像 android 一样隐藏和消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 UI 设计中使用了带有自动布局的情节提要.基本上在 android 中会有三个不同的属性,比如 VisibleInvisibleGone.

                  I have used storyboard with autolayout for my UI design. Basically in android there are three different properties will be there like Visible, Invisible and Gone.

                  例如:

                     1) android:visibility="gone" // used to hide the control and as well as space
                        (or)
                        CONTROLNAME.setVisibility(View.GONE);
                     2)  android:visibility="invisible" // used to hide the control but it will take space
                        (or)
                        CONTROLNAME.setVisibility(View.INVISIBLE);
                  

                  在 iOS 中,

                  objective-c

                    1) ?
                    2) [CONTROLNAME setHidden:TRUE]; // used to hide the control but it will take space
                  

                  迅速

                    1) ?
                    2) CONTROLNAME.isHidden = true  // used to hide the control but it will take space
                  

                  作为 iOS 中的 Gone 我已经从谷歌搜索但我无法找到解决方案.

                  for act as a Gone in iOS i have searched from google but i can't able to find the Solution.

                  推荐答案

                  要删除视图(控件)占用的空间,可以将其框架的 size 减小为零或将其从查看层次结构.IE.通过在控件上调用 removeFromSuperview.

                  To remove the space occupied by a view(control) can either reduce the size of its frame to zero or remove it from the view hierarchy. I.e. by calling removeFromSuperview on the control.

                  例如,如果您必须删除 UITextField(例如 CONTROLNAME)占用的空间,那么您可以使用:

                  For example if you have to remove the space occupied by a UITextField (say CONTROLNAME), then you can either use:

                  CGRect tempFrame = CONTROLNAME.frame;
                  CGSize currentSize = tempFrame.size; //for later use
                  tempFrame.size = CGSizeZero;
                  CONTROLNAME.frame = tempFrame;
                  

                  CGRect currentFrame = CONTROLNAME.frame; //for later use
                  [CONTROLNAME removeFromSuperview];
                  

                  更新:

                  在第一种情况下,您必须存储较早的大小才能将控件恢复到其初始位置.

                  In the first case you will have to store the earlier size to bring back the control to its initial position.

                  CGRect tempFrame = CONTROLNAME.frame;
                  tempFrame.size = currentSize; //set to initial value
                  CONTROLNAME.frame = tempFrame;
                  

                  在第二种情况下,您必须存储控件的框架以将其带回其初始位置(如果它是局部变量或弱实例变量,则还包括控件本身).

                  In the second case you will have to store the frame of the control to bring it back to its initial position (and also the control itself if it is a local variable or weak instance variable).

                  CONTROLNAME.frame = currentFrame;
                  

                  这篇关于iOS 控件像 android 一样隐藏和消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:意外 NSAutoresizingMaskLayoutConstraint 的 AutoLayout 约束问题 下一篇:使用 TabBar 问题限制到底部布局指南

                  相关文章

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

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

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

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