简体   繁体   English

导航栏顶部项,不显示后退栏按钮,创建时左侧显示,但不显示箭头

[英]Navigation Bar Top Item, not showing back bar button, the left is showing when created but it doesnt show the arrow <

The code is in Objective-C and I would like to have the arrow appearing without adding an image as a src. 该代码在Objective-C中,我希望箭头出现而无需添加图像作为src。 I've done projects where it appears automatically when changing the controller. 我已经完成了一些项目,这些项目在更改控制器时会自动出现。

Here I created the left bar button: 在这里,我创建了左栏按钮:

 navItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(returnToPreviousScreen)];

This is showing great and working as desired, but it doesnt show the < arrow on the left side of the text. 这样显示效果很好,并且可以正常工作,但是在文本的左侧没有显示<箭头。 If I try to create a backbar button it doesnt work at all; 如果我尝试创建一个backbar按钮,则根本不起作用。 doesnt even shows it. 甚至没有显示它。

Try setting backBarButtonItem property on navigationItem , but instead of doing it in the view controller that was pushed, do it in the previous view controller. 尝试在navigationItem上设置backBarButtonItem属性,但不要在之前推送的视图控制器中进行设置,而应在前一个视图控制器中进行设置。 You can set the target and selector to nil, it won't have any effect when set on backBarButtonItem . 您可以将目标和选择器设置为nil,将其设置为backBarButtonItem不会产生任何影响。

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

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