更改 popovercontroller 按钮名称
我制作了一个 ipad splitview 应用程序,我将更改在纵向模式下控制表格的按钮名称。因此,每次按下另一个按钮时,我都会更改此名称“Indice”。
默认按钮是这样的(我更改了“Indice”中的默认名称“Root List”):
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"):
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您引用的代码将按钮作为“toolbar”属性的工具栏项上的第 0 项插入,因此您可以稍后返回该按钮并设置如下文本:
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: