Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>UIToolbar* toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 45)]; [toolbar setBarStyle: UIBarStyleBlackOpaque]; // create an array for the buttons NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:5]; // create a standard save button UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(deleteAction:)]; saveButton.style = UIBarButtonItemStyleBordered; [buttons addObject:saveButton]; [saveButton release]; // create a standard delete button with the trash icon UIBarButtonItem *deleteButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemTrash target:self action:@selector(deleteAction:)]; deleteButton.style = UIBarButtonItemStyleBordered; [buttons addObject:deleteButton]; [deleteButton release]; UIBarButtonItem *addbutton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(deleteAction:)]; addbutton.style = UIBarButtonItemStyleBordered; [buttons addObject:addbutton]; [addbutton release]; UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(deleteAction:)]; editButton.style = UIBarButtonItemStyleBordered; [buttons addObject:editButton]; [editButton release]; UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(deleteAction:)]; doneButton.style = UIBarButtonItemStyleBordered; [buttons addObject:doneButton]; [doneButton release]; // put the buttons in the toolbar and release them [toolbar setItems:buttons animated:NO]; [buttons release]; // place the toolbar into the navigation bar self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:toolbar]; [toolbar release]; </code></pre> <p><strong>Try this code snippet</strong></p> <p>And In AppDelegate.h file you declare this</p> <pre><code>UINavigationController *navigationController; </code></pre> <p>And AppDelegate.m file</p> <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. // Add the view controller's view to the window and display. navigationController = [[UINavigationController alloc] initWithRootViewController:viewController]; [self.window addSubview:navigationController.view]; [self.window makeKeyAndVisible]; return YES; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload