简体   繁体   English

如何设置导航栏的后退箭头?

[英]How to set the back arrow of the navigation bar?

When I push from view controller1 to view controller2, there seems no back button item on the view controller2's navigation bar. 当我从视图控制器1推到视图控制器2时,视图控制器2的导航栏上似乎没有后退按钮项。

在此处输入图片说明

The result of vc2 : vc2的结果:

How to set that in storyboard? 如何在情节提要中设置它?

If you are pushing view controller from VC1 to VC2 through navigation controller then write below line in VC2's viewWillAppear method. 如果要通过导航控制器将视图控制器从VC1推到VC2,则在VC2的viewWillAppear方法中的以下行中编写。

If you are using Swift 3.0 : 如果您使用的是Swift 3.0:

 self.navigationController?.navigationBar.isHidden = false

 self.navigationItem.setHidesBackButton(false, animated:true);

I see your Controller1's navigation bar have left bar button item and right bar button item. 我看到Controller1的导航栏有左栏按钮项和右栏按钮项。

You can drag a button item to your VC2's navigation item. 您可以将按钮项拖到VC2的导航项中。

在此处输入图片说明

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

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