xcode 如何在 UIBarButtonItem 中制作箭头,如 swift 中的后退按钮箭头

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32399330/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:46:41  来源:igfitidea点击:

How to make a arrow in UIBarButtonItem like back button arrow in swift

iosxcodeswiftuibarbuttonitem

提问by Alexander Khitev

How to make a arrow in custom UIBarButtonItemlike back buttom arrow in the Swift? I want to move via previous controller and I make custom UIBarButtonControllerbut it has not arrow.

如何UIBarButtonItem在Swift中像后退箭头一样自定义箭头?我想通过以前的控制器移动并进行自定义UIBarButtonController但它没有箭头。

enter image description here

enter image description here

回答by baydi

U can use Attributed String and assign it to your UIButton Use this string

您可以使用属性字符串并将其分配给您的 UIButton 使用此字符串

var str = "< Playlist Table"

var str = "< Playlist Table"

Use this tutorial for further detail http://www.ioscreator.com/tutorials/attributed-strings-tutorial-ios8-swift

使用本教程了解更多详情http://www.ioscreator.com/tutorials/attributed-strings-tutorial-ios8-swift

It will Help.ThankYou

它会有所帮助。谢谢

回答by user44776

Custom Back Button

自定义后退按钮

For those of you are here to make a custom back button, check this similar SO answerwhich works perfectly.

对于那些在这里制作自定义后退按钮的人,请查看此类似的 SO 答案,该答案非常有效。

回答by user5300943

If you have a navigation controller, this should appear automatically when you move from ViewController A to B.

如果你有一个导航控制器,当你从 ViewController A 移动到 B 时它应该会自动出现。

To change the text "Playlist Table" in controller B, you need to set it on controller A.

要更改控制器 B 中的文本“播放列表”,您需要在控制器 A 上进行设置。