更改 popovercontroller 按钮名称

发布于 2024-12-01 23:48:18 字数 1051 浏览 4 评论 0原文

我制作了一个 ipad splitview 应用程序,我将更改在纵向模式下控制表格的按钮名称。因此,每次按下另一个按钮时,我都会更改此名称“Indice”。

默认按钮是这样的(我更改了“Indice”中的默认名称“Root List”):

image http://img225.imageshack.us/img225/7199/schermata082455805alle0f.png

默认情况下它是控制器方法:

- (void)splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc {

[(UINavigationController *)aViewController navigationBar].barStyle = UIBarStyleBlackOpaque;

barButtonItem.title = @"Indice"; //Cambiamo il nome del pulsante che richiama la tabella in posizione Portrait
NSMutableArray *items = [[toolbar items] mutableCopy];
[items insertObject:barButtonItem atIndex:0];
[toolbar setItems:items animated:YES];
[items release];
self.popoverController = pc;  }

那我该怎么办呢?

I made an ipad splitview application and I would change the button name that control the table in portrait mode. So I would change this name "Indice", each time I press another button.

The default button is this (I changed the default name "Root List" in "Indice"):

image
http://img225.imageshack.us/img225/7199/schermata082455805alle0f.png

and it's controller by this default method:

- (void)splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc {

[(UINavigationController *)aViewController navigationBar].barStyle = UIBarStyleBlackOpaque;

barButtonItem.title = @"Indice"; //Cambiamo il nome del pulsante che richiama la tabella in posizione Portrait
NSMutableArray *items = [[toolbar items] mutableCopy];
[items insertObject:barButtonItem atIndex:0];
[toolbar setItems:items animated:YES];
[items release];
self.popoverController = pc;  }

So how can I do?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

痴情换悲伤 2024-12-08 23:48:18

由于您引用的代码将按钮作为“toolbar”属性的工具栏项上的第 0 项插入,因此您可以稍后返回该按钮并设置如下文本:

UIBarButtonItem *popoverButton = [[self.toolbar items] objectAtIndex:0];
popoverButton.title = @"Hello";

Since the code you quoted inserts the button as item zero on the toolbar items of a property called 'toolbar', you can get the button back later and set the text like this:

UIBarButtonItem *popoverButton = [[self.toolbar items] objectAtIndex:0];
popoverButton.title = @"Hello";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文