2010-03-28 61 views

回答

0

创建信息图像,然后使用-initWithImage:style:target:action:

+2

虽然我认为原来的海报根本就不是google搜索答案,寻找一种简单的,我真的需要帮助,这并没有得到这篇文章来自谷歌。这个答案需要提供更详细的说明和完整的代码示例。 – Kyle 2010-09-19 14:41:16

+2

最好使用预定义的信息按钮类型,因为标准信息按钮的外观可能会随着未来的操作系统版本而改变。 – omz 2011-01-18 08:07:06

13

您需要创建类型UIButtonTypeInfoLight(或者,取决于您的工具栏颜色UIButtonTypeInfoDark)的UIButton。然后你会使用这个按钮作为一个UIBarButtonItem自定义视图:

UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeInfoLight]; 
UIBarButtonItem *infoButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:infoButton] autorelease]; 
myToolbar.items = [NSArray arrayWithObjects:infoButtonItem, nil];