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"):
http://img225.imageshack.us/img225/7199/schermata082455805alle0f.pngand 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";
精彩评论