简体   繁体   English

如何在iPhone导航栏中一起添加图像和文本

[英]How to add image and text together in iPhone Navigation bar

如何在iPhone导航栏中一起添加图像和文本?

对于我的答案,我假设您要在NavBar中显示图像,并在其上方显示文本提示-在这种情况下,您将要使用UINavigationItem类上的prompt属性。

From a view controller, you can ask for self.navigationController.navigationBar and add subviews to that. 在视图控制器中,您可以要求self.navigationController.navigationBar并为其添加子视图。

Or, you can wrap image/text into a UIView, and create a UIBarButtonItem with a custom view set to that combination. 或者,您可以将图像/文本包装到UIView中,并创建一个UIBarButtonItem并将其自定义视图设置为该组合。

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

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