开发者

Changing popovercontroller button name

开发者 https://www.devze.com 2023-04-01 02:29 出处:网络
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.

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开发者_如何学Go changed the default name "Root List" in "Indice"):

Changing popovercontroller button name

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?


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";
0

精彩评论

暂无评论...
验证码 换一张
取 消