Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 iPhone 导航栏中同时添加图像和文本?
对于我的回答,我假设您想在 NavBar 中显示一个带有文本提示的图像 - 在这种情况下,您希望使用 UINavigationItem 类的 prompt 属性。
从视图控制器,您可以请求 self.navigationController.navigationBar 并向其中添加子视图。
或者,您可以将图像/文本包装到 UIView 中,并创建一个 UIBarButtonItem 并将自定义视图设置为该组合。