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

      1. <tfoot id='dGm4Y'></tfoot>

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

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

      2. 在“更多"中没有调用 didSelectViewController部分

        时间:2023-09-12
      3. <small id='dEpma'></small><noframes id='dEpma'>

            <tbody id='dEpma'></tbody>

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

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

                  <tfoot id='dEpma'></tfoot>
                  本文介绍了在“更多"中没有调用 didSelectViewController部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个 UITabBarController 并设置了它的委托方法 didSelectViewController,因为我对正在选择的选项卡的索引感兴趣.

                  但是,我注意到 didselectviewontroller 方法在更多"部分中没有被调用(当有更多的标签时,在Tabbar中可以显示):

                  有没有办法让我收到有关用户从自动创建的表中选择的项目的通知?

                  解决方案

                  我在 这个问题.

                  基本上,您为更多选项卡中显示的导航控制器设置了 UITabBarControllerDelegate UINavigationControllerDelegate.之后,您可以检测用户是否触摸了其中一个可见选项卡或更多"选项卡.

                  编辑

                  另外,要直接操作在更多"导航控制器中可见的表格,您可以设置一个中间人"表格视图委托,它会拦截对原始委托的调用.请参阅下面 didSelectViewController 内部的代码:

                  if (viewController == tabBarController.moreNavigationController && tabBarController.moreNavigationController.delegate == nil) {//这里我们用我们自己的实现替换更多"选项卡表委托//这允许我们无缝替换视图控制器UITableView *view = (UITableView *)self.tabBarController.moreNavigationController.topViewController.view;self.originalDelegate = view.delegate;view.delegate = 自我;}

                  之后,您可以在委托方法中自由地做任何您喜欢的事情,只要您在另一个委托中调用相同的方法(我实际上检查了原始委托响应的方法,以及唯一的委托方法实现的是 didSelectRow:forIndexPath:).请参阅下面的示例:

                  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {//这是更多"选项卡表的委托//如果需要,它会拦截任何触摸并替换选定的视图控制器//然后,它调用原始委托以保留更多"选项卡的行为//在这里做任何事情//然后调用原始委托[self.originalDelegate tableView: tableView didSelectRowAtIndexPath: indexPath];}

                  I have a UITabBarController and I have set up its delegate method didSelectViewController, as I am interested in the index of the tab that is being selected.

                  However, I noticed that the didSelectViewController method doesn't get called when the user is in the "More" section (when there are more tabs than can be shown in the tabbar):

                  Is there a way for me to get notified of the items the user selects from the table that is being automatically created?

                  解决方案

                  I found what I needed in this question.

                  Basically you set up a UITabBarControllerDelegate and a UINavigationControllerDelegate for the navigation controller that is displayed inside the More tab. After that you detect if the user touched one of the visible tabs, or the "More" tab.

                  EDIT

                  Also, to directly manipulate the table that is visible within the "More" navigation controller, you can set up a "man-in-the-middle" table view delegate, that intercepts the calls to the original delegate. See code from inside didSelectViewController below:

                  if (viewController == tabBarController.moreNavigationController && tabBarController.moreNavigationController.delegate == nil) {
                      // here we replace the "More" tab table delegate with our own implementation
                      // this allows us to replace viewControllers seamlessly
                  
                      UITableView *view = (UITableView *)self.tabBarController.moreNavigationController.topViewController.view;
                      self.originalDelegate = view.delegate;
                      view.delegate = self;
                  }
                  

                  After that, you are free to do whatever you like inside the delegate methods, as long as you call the same methods in the other delegate (I actually checked to which methods the original delegate responds, and the only delegate method that is implemented is the didSelectRow:forIndexPath:). See an example below:

                  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
                      // this is the delegate for the "More" tab table
                      // it intercepts any touches and replaces the selected view controller if needed
                      // then, it calls the original delegate to preserve the behavior of the "More" tab
                  
                      // do whatever here 
                      // and call the original delegate afterwards
                      [self.originalDelegate tableView: tableView didSelectRowAtIndexPath: indexPath];
                  }
                  

                  这篇关于在“更多"中没有调用 didSelectViewController部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:滚动tableView时的UITableView委托动作? 下一篇:Android:一旦 webview 完成滚动,就使按钮可见

                  相关文章

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

                    <legend id='1ImHv'><style id='1ImHv'><dir id='1ImHv'><q id='1ImHv'></q></dir></style></legend>

                    <small id='1ImHv'></small><noframes id='1ImHv'>

                    • <bdo id='1ImHv'></bdo><ul id='1ImHv'></ul>