• <small id='098U9'></small><noframes id='098U9'>

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

          <bdo id='098U9'></bdo><ul id='098U9'></ul>

        从一个类调用 IBOutlet UIButton 到另一个 Viewcontroller

        时间:2023-07-06
          <tbody id='TvHjW'></tbody>

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

            <tfoot id='TvHjW'></tfoot>

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

                • 本文介绍了从一个类调用 IBOutlet UIButton 到另一个 Viewcontroller的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个名为 dataviewcontroller 的视图控制器.另一个名为 scopeviewcontroller

                  I have one view controller called dataviewcontroller.Another view controller called scopeviewcontroller

                  dataviewcontroller 我有一个名为 AddDataIBOutletUIButton.我想在我的scopeviewcontroller.我想隐藏那个按钮.

                  In dataviewcontroller i have an IBOutlet of UIButton called AddData.I want to call this button in my scopeviewcontroller. And I want to hide that button.

                  我在我的 pager 中使用了这个视图控制器.我想在第三页的 scopeviewcontroller 中隐藏 AddData 按钮.

                  I have used this view controller in my pager. I want to hide AddData button in my scopeviewcontroller which is present at the third page.

                  我在 scopeviewcontroller 中的 viewdidload 中尝试了此代码.

                  I tried this code in viewdidload in my scopeviewcontroller.

                  但是我得到这个错误:UIViewController"类型的值没有成员AddData"

                  我在第一个视图控制器中的代码:

                  my code in first view controller:

                  class dataviewcontroller: UIViewController {
                  
                      @IBOutlet var AddData: UIButton! 
                  }
                  

                  我的第二个视图控制器:

                  class scopeviewcontroller: UIViewController,UITableViewDelegate, UITableViewDataSource {
                  
                   override func viewDidLoad() {
                          super.viewDidLoad()
                  let storyboard = UIStoryboard(name: "data", bundle: nil)
                         let controller = storyboard.instantiateViewController(withIdentifier: "dataviewcontroller")
                  
                          controller.AddData.hidden = true
                  
                      }
                  
                  
                  }
                  

                  请帮帮我!...谢谢

                  推荐答案

                  您无需访问您在寻呼机上添加的每个视图控制器上的按钮.您可以隐藏 scopeviewcontroller 本身的按钮.在 CAPSPageMenuDelegate

                  You no need to access the button on every view controllers, which you added on the pager. You can hide the button on the scopeviewcontroller itself. with the help of CAPSPageMenuDelegate

                  在 ScopeViewController 中,设置寻呼机的委托.

                  In ScopeViewController, set the delegate of your pager.

                  fun viewDidLoad() {
                     super.viewDidLoad()
                     pageMenu.delegate = self 
                  }
                  

                  并实现协议CAPSPageMenuDelegate

                  extension scopeviewcontroller: CAPSPageMenuDelegate {
                      func willMoveToPage(_ controller: UIViewController, index: Int) {
                          self.AddData.isHidden = (index == 2)
                      }
                  }
                  

                  这篇关于从一个类调用 IBOutlet UIButton 到另一个 Viewcontroller的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何使用 imageEdgeInsets 更改 UIButton 中图像的 tintColor? 下一篇:如何更改特定 TableViewCell 中的按钮颜色

                  相关文章

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

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