• <tfoot id='YJ0xQ'></tfoot>

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

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

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

        设置 leftBarButtonItem 后如何在 UINavigationController 中启用后退/左滑手势?

        时间:2023-05-16
          <bdo id='p64te'></bdo><ul id='p64te'></ul>

            <tbody id='p64te'></tbody>
          <legend id='p64te'><style id='p64te'><dir id='p64te'><q id='p64te'></q></dir></style></legend>
            <tfoot id='p64te'></tfoot>

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

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

                  本文介绍了设置 leftBarButtonItem 后如何在 UINavigationController 中启用后退/左滑手势?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我从 这里得到了相反的问题.iOS7 默认情况下,UINavigationController 堆栈的向后滑动手势可以弹出呈现的ViewController.现在我只是统一了所有 ViewControllers 的所有 self.navigationItem.leftBarButtonItem 样式.

                  I got the opposite issue from here. By default in iOS7, back swipe gesture of UINavigationController's stack could pop the presented ViewController. Now I just uniformed all the self.navigationItem.leftBarButtonItem style for all the ViewControllers.

                  代码如下:

                  self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:LOADIMAGE(@"back_button") style:UIBarButtonItemStylePlain target:self action:@selector(popCurrentViewController)];
                  

                  之后,navigationController.interactivePopGestureRecognizer 被禁用.如何在不删除自定义 leftBarButtonItem 的情况下启用弹出手势?

                  after that, the navigationController.interactivePopGestureRecognizer is disabled. How could I make the pop gesture enabled without removing the custom leftBarButtonItem?

                  谢谢!

                  推荐答案

                  在viewDidLoad中首先设置委托:

                  First set delegate in viewDidLoad:

                  self.navigationController.interactivePopGestureRecognizer.delegate = self;
                  

                  然后在推送时禁用手势:

                  And then disable gesture when pushing:

                  - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
                      [super pushViewController:viewController animated:animated];
                      self.interactivePopGestureRecognizer.enabled = NO;
                  }
                  

                  并在 viewDidDisappear 中启用:

                  And enable in viewDidDisappear:

                  self.navigationController.interactivePopGestureRecognizer.enabled = YES;
                  

                  另外,将 UINavigationControllerDelegate 添加到您的视图控制器.

                  Also, add UINavigationControllerDelegate to your view controller.

                  这篇关于设置 leftBarButtonItem 后如何在 UINavigationController 中启用后退/左滑手势?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:UIRefreshControl - 当 UITableViewController 在 UINavigationCon 下一篇:我可以弹出到特定的 ViewController 吗?

                  相关文章

                      <tfoot id='bz4Bc'></tfoot>
                    1. <small id='bz4Bc'></small><noframes id='bz4Bc'>

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