1. <legend id='MU3A8'><style id='MU3A8'><dir id='MU3A8'><q id='MU3A8'></q></dir></style></legend>
        <bdo id='MU3A8'></bdo><ul id='MU3A8'></ul>

    2. <small id='MU3A8'></small><noframes id='MU3A8'>

      <tfoot id='MU3A8'></tfoot>

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

      如何在情节提要导航控制器中替换/自定义后退按钮图像

      how to replace/customize back button image in storyboard navigationcontroller(如何在情节提要导航控制器中替换/自定义后退按钮图像)
    3. <small id='TkZyY'></small><noframes id='TkZyY'>

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

          <legend id='TkZyY'><style id='TkZyY'><dir id='TkZyY'><q id='TkZyY'></q></dir></style></legend>
              <tbody id='TkZyY'></tbody>

              • <bdo id='TkZyY'></bdo><ul id='TkZyY'></ul>
                本文介绍了如何在情节提要导航控制器中替换/自定义后退按钮图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我想用自定义图像替换后退按钮中的文本.我怎样才能在快速代码中做到这一点?我不想替换整个后退按钮,因为我想保留返回到最后一个视图的默认操作行为.我还想根据返回目的地(基于 storyboardId)的位置做一个 switch 语句,以便我可以根据视图显示不同的图像.

                I want to replace the text in the back button with a custom image. How can I do that in swift code? I don't want to replace the entire backbarbutton since I'd like to keep the default action behaviour of going back to the last view. I would also like to do a switch statement based on where the back destination(based on storyboardId) is so that I can show different images based on the view.

                这会替换图像,但会消除默认的后退按钮行为,我需要区分后退目标是什么,以便显示正确的后退图像.

                this replaces the image but it wipes out the default back button behavior, and I need to discrimante on what the back destination is so that I can show the right back image.

                self.navigationItem.leftBarButtonItem = 
                 UIBarButtonItem(image:StyleKit.imageOfMap, style:.Plain, target:self, action:nil);
                

                推荐答案

                尝试改变你的 leftBarButtonItem:

                self.navigationItem.leftBarButtonItem = 
                    UIBarButtonItem(image:StyleKit.imageOfMap, style:.Plain, target:self, action:nil);
                

                到一个backBarButtonItem:

                self.navigationItem.backBarButtonItem = 
                    UIBarButtonItem(image:StyleKit.imageOfMap, style:.Plain, target:self, action:nil);
                

                为了利用backBarButtonItem的默认动作.

                然后将那行代码放在视图控制器中您希望自定义后退按钮出现的那个之前.

                And put that line of code in the view controller preceding the one you'd like your custom back button to appear in.

                编辑:如果您不想要<"符号出现在您的按钮上,实际上您必须使用 leftBarButtonItem 然后在单独的方法中关闭视图控制器,例如:

                Edit: If you don't want the "<" symbol to appear on your button, you'll have to in fact use a leftBarButtonItem then dismiss the view controller in a separate method, ex:

                    self.navigationItem.leftBarButtonItem = 
                        UIBarButtonItem(image:StyleKit.imageOfMap, style:.Plain, target:self, action:"backButtonPressed:");
                
                }
                
                func backButtonPressed(sender:UIButton) {
                    navigationController?.popViewControllerAnimated(true)
                }
                

                这篇关于如何在情节提要导航控制器中替换/自定义后退按钮图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                UINavigationController inside a UITabBarController inside a UISplitViewController presented modally on iPhone(UISplitViewController 内的 UITabBarController 内的 UINavigationController 以模态方式呈现在 iPhone 上) - IT屋-程序员软件开发技术分
                ViewController in UINavigationController orientation change(UINavigationController 中的 ViewController 方向更改)
                Custom back button in UINavigationController(UINavigationController 中的自定义后退按钮)
                How to add a navigation controller programmatically in code but not as initial view controller(如何在代码中以编程方式添加导航控制器,但不作为初始视图控制器)
                The correct way to set a light status bar text color in iOS 7 based on different ViewControllers(iOS 7中基于不同ViewControllers设置灯光状态栏文字颜色的正确方法)
                View being blocked by UITransitionView after being presented(呈现后被 UITransitionView 阻止的视图)
                  <i id='Igrin'><tr id='Igrin'><dt id='Igrin'><q id='Igrin'><span id='Igrin'><b id='Igrin'><form id='Igrin'><ins id='Igrin'></ins><ul id='Igrin'></ul><sub id='Igrin'></sub></form><legend id='Igrin'></legend><bdo id='Igrin'><pre id='Igrin'><center id='Igrin'></center></pre></bdo></b><th id='Igrin'></th></span></q></dt></tr></i><div id='Igrin'><tfoot id='Igrin'></tfoot><dl id='Igrin'><fieldset id='Igrin'></fieldset></dl></div>
                    <tbody id='Igrin'></tbody>

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

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

                        <legend id='Igrin'><style id='Igrin'><dir id='Igrin'><q id='Igrin'></q></dir></style></legend><tfoot id='Igrin'></tfoot>