【发布时间】:2012-06-28 23:54:37
【问题描述】:
我可以将系统项分配给UIBarButtonItem 而无需重新创建它吗?仅在现有按钮上调用 initWithBarButtonSystemItem 似乎对我不起作用。
This 是我试图让它工作的代码。我正在尝试使用 PhoneGap 改进对 iOS 的本机控件支持。该插件可以毫无问题地更改标题/图像,但我必须弄清楚如何将系统提供的图标分配给现有按钮。
【问题讨论】:
标签: ios uibarbuttonitem
我可以将系统项分配给UIBarButtonItem 而无需重新创建它吗?仅在现有按钮上调用 initWithBarButtonSystemItem 似乎对我不起作用。
This 是我试图让它工作的代码。我正在尝试使用 PhoneGap 改进对 iOS 的本机控件支持。该插件可以毫无问题地更改标题/图像,但我必须弄清楚如何将系统提供的图标分配给现有按钮。
【问题讨论】:
标签: ios uibarbuttonitem
我查看了您的代码,没有发现您使用initWithBarButtonSystemItem。然而,这是我在原生 iOS 编程的类似案例中所做的:
UIBarButtonItem *myButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done)];
self.navigationItem.rightBarButtonItem = myButton;
[myButton release];
这对我来说是正确的。我不熟悉 PhoneGap,但它可能会也可能不会改变。
【讨论】: