iphone - 如何将 UIBarButtonItem 添加到其中包含文本和图像的 UIToolbar?

标签 iphone objective-c xcode cocoa-touch ipad

如何将 UIBarButtonItem 添加到包含文本和图像的 UIToolbar 中?看看我展示的示例图像。这正是我想要做的。

Here's the image

最佳答案

首先创建一个带有图像和标题的 UIButton。

然后将该按钮添加到 BarButtonItem

UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithCustomView:customButton];

关于iphone - 如何将 UIBarButtonItem 添加到其中包含文本和图像的 UIToolbar?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7657451/

相关文章:

使用 "2x"按钮时 iPhone OpenGL ES 应用程序在 iPad 上被终止

objective-c - __attribute__((const)) 使用 Clang 在 Objective-C 方法上工作吗?

ios - 在 iOS 中关闭地址簿

iphone - 尝试在数字键盘上实现完成/取消按钮,但在模拟器中选择文本字段时会出现错误

ios - 如果 app delegate 想快速使用主 Storyboard文件,它必须实现 window 属性

iphone - 我应该如何保护 iOS 中的 SQLite 数据库?

iphone - NSDecimal 需要桥接

ios - 在断点条件中访问类

xcode - 分段控制中的表情符号

iphone - 如何克服导航栏的影响