<tfoot id='3BV3n'></tfoot>

    • <bdo id='3BV3n'></bdo><ul id='3BV3n'></ul>

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

      <small id='3BV3n'></small><noframes id='3BV3n'>

      用 ViewContainer 中的按钮隐藏视图容器

      Hide a view container with a button in the ViewContainer(用 ViewContainer 中的按钮隐藏视图容器)
      <tfoot id='0m0yT'></tfoot>

          <tbody id='0m0yT'></tbody>

          <bdo id='0m0yT'></bdo><ul id='0m0yT'></ul>
            • <small id='0m0yT'></small><noframes id='0m0yT'>

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

              1. <legend id='0m0yT'><style id='0m0yT'><dir id='0m0yT'><q id='0m0yT'></q></dir></style></legend>
                本文介绍了用 ViewContainer 中的按钮隐藏视图容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个视图.在这个视图中,我有一个 Container View.在 ContainerView 我有一个按钮.

                I have a View. In this view, I have a Container View. And in the ContainerView I have a button.

                当我触摸 ContainerView 的按钮时,我希望 ContainerView 被隐藏.

                When I am touching the button of the ContainerView, I want the ContainerView become hidden.

                我想做这样的事情:

                class ContainerView: UIViewController {
                
                    @IBAction func closeContainerViewButton(sender: AnyObject) {
                        //I try this : self.hidden = false
                        //or this :    self.setVisibility(self.INVISIBLE)
                    }
                
                }
                

                知道怎么做吗?

                推荐答案

                有多种方法,但这里是最简单的一种,虽然不是最漂亮的.你真的应该使用委托,但这是一种入门的方式.只需创建一个包含容器的类的全局变量(在本例中为 startController).然后从您的其他视图控制器 (MyViewInsideContainer) 调用它并告诉它隐藏您所在的视图.我没有运行此代码,但它应该可以工作.

                There are serval ways but here is the easiest one, not prettiest though. You should really use delegates but this is a hacky way to get started. Just create a global variable of the class that holds the container (startController in this case). Then call it from your other view controller (MyViewInsideContainer) and tell it to hide the view youre in. I have not run this code but it should work.

                var startController = StartController()
                
                class StartController:UIViewController {
                
                    @IBOutlet var myViewInsideContainerView: UIView
                
                    ....
                
                    override func viewDidLoad() {
                        super.viewDidLoad()
                        startController = self
                    }
                
                    func hideContainerView(){
                        self.myContainerView.hidden = true
                    }
                }
                
                class MyViewInsideContainer:UIViewController {
                
                    ...
                
                    @IBAction func hideThisView(sender: AnyObject) {
                        startController.hideContainerView()
                    }
                
                }
                

                这篇关于用 ViewContainer 中的按钮隐藏视图容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                UIButton title text color(UIButton 标题文本颜色)
                Stretch background image for UIButton(为 UIButton 拉伸背景图像)
                Using Tint color on UIImageView(在 UIImageView 上使用 Tint 颜色)
                How can I change UIButton title color?(如何更改 UIButton 标题颜色?)
                iPhone UIButton - image position(iPhone UIButton - 图像位置)
                UIButton remove all target-actions(UIButton 删除所有目标动作)
                <tfoot id='YM2zh'></tfoot>
              2. <small id='YM2zh'></small><noframes id='YM2zh'>

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

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