简体   繁体   English

如何从导航栏中完全删除后退按钮?

[英]How to completely remove back button from navigation bar?

For some reason I'm adding left and right buttons to the navigation bar as its subview instead of using navigation item. 由于某种原因,我向导航栏添加了左右按钮作为其子视图,而不是使用导航项。 When pushing a view controller, I'm setting its navigationItem.hidesBackButton to YES so that the ugly looking blue 'back' button will not show up. 当推一个视图控制器时,我将其navigationItem.hidesBackButton设置为YES ,以使看起来难看的蓝色“后退”按钮不会出现。 The problem I'm facing is that, after tapping my own back button, while the currently showing view controller being popped --- I mean during the animation of the 'pop', I can see a '...' in the navigation bar moving right along with the popped view controller. 我面临的问题是,在点击我自己的后退按钮后,当当前显示的视图控制器被弹出时,---我的意思是在“ pop”动画期间,我可以在导航中看到“ ...”栏随弹出的视图控制器一起向右移动。 And, I DON'T want that '...' to appear for even 0.0000000001 second. 而且,我不希望该“ ...”出现甚至0.0000000001秒。 What may I do now? 我现在该怎么办? Any hint would be appreciated. 任何提示将不胜感激。

Note:Problem solved with just comment. 注意:问题仅需注释即可解决。 But posting this as answer so that It will help someone else having same issue. 但是将其发布为答案,这样可以帮助遇到相同问题的其他人。

I too had same problem with navigationBarButtonItem while adding custom barButtonItem to navigationBar in storyboard. 我也曾经有过同样的问题navigationBarButtonItem而添加自定义barButtonItemnavigationBar在故事板。 If you are also using storyboard then just set navigationBar tint color as clear color in navigationController . 如果您也使用故事板则只需设置navigationBar色调的颜色一样清晰颜色navigationController By setting clear color, that weird default navigation back button will not appear anymore. 通过设置清晰的颜色,该怪异的默认导航后退按钮将不再显示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM