[英]Add image to Navigation Bar Back Button
I want to have the back button with "< [IMG]" instead of "< Back" which is by default. 我希望后退按钮带有“<[IMG]”而不是默认的“<Back”。
let barAppearace = UIBarButtonItem.appearance()
barAppearace.setBackButtonTitlePositionAdjustment(UIOffsetMake(0, -60), for:UIBarMetrics.default)
with this I have removed the text but how to add an image next to the "<". 有了这个,我删除了文本,但如何在“<”旁边添加图像。
let backButton = UIBarButtonItem(image:UIImage(named: "ic_authors_detail_back.png"), style:.Plain, target:self, action:"backButtonPressed");
backButton.tintColor = UIColor(hexString: "#ffffffff")
let leftBarButtonsArray = [backButton]
navigationItem.leftBarButtonItems = leftBarButtonsArray
Here is the code to add a button on navigation bar.Hope this helps 这是在导航栏上添加按钮的代码。希望这有帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.