iphone - Multiple UIBarButtonItems in UINavigationBar -


how create multiple bar button in navigation bar?

you must use uitoolbar , set toolbar buttons:

// create toolbar can place buttons uitoolbar *toolbar = [[uitoolbar alloc]                         initwithframe:cgrectmake(0, 0, 100, 45)]; [toolbar setbarstyle: uibarstyleblackopaque];  // create array buttons nsmutablearray *buttons = [[nsmutablearray alloc] initwithcapacity:3];  // create standard save button uibarbuttonitem *savebutton = [[uibarbuttonitem alloc]     initwithbarbuttonsystemitem:uibarbuttonsystemitemsave     target:self     action:@selector(saveaction:)]; savebutton.style = uibarbuttonitemstylebordered; [buttons addobject:savebutton];  // create spacer between buttons uibarbuttonitem *spacer = [[uibarbuttonitem alloc]     initwithbarbuttonsystemitem:uibarbuttonsystemitemfixedspace     target:nil     action:nil]; [buttons addobject:spacer];  // create standard delete button trash icon uibarbuttonitem *deletebutton = [[uibarbuttonitem alloc]     initwithbarbuttonsystemitem:uibarbuttonsystemitemtrash     target:self     action:@selector(deleteaction:)]; deletebutton.style = uibarbuttonitemstylebordered; [buttons addobject:deletebutton];  // put buttons in toolbar , release them [toolbar setitems:buttons animated:no];  // place toolbar navigation bar self.navigationitem.rightbarbuttonitem = [[uibarbuttonitem alloc]                                            initwithcustomview:toolbar]; 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -