Posted By

paki on 05/13/11


Tagged

objectivec UIToolbar


Versions (?)

Simple UIToolbar Initialization


 / Published in: Objective C
 

  1. UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 40, self.view.frame.size.width, 40)];
  2. toolbar.barStyle = UIBarStyleBlack;
  3.  
  4. UIBarButtonItem *barBtnCancel = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonSystemItemAction target:nil action:nil];
  5. UIBarButtonItem *barBtnRightButton = [[UIBarButtonItem alloc] initWithTitle:@"Some Text" style:UIBarButtonSystemItemCamera target:nil action:nil];
  6. UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
  7. NSArray *toolbarButtons = [[NSArray alloc] initWithObjects:barBtnCancel, flexSpace, barBtnRightButton, nil];
  8.  
  9. toolbar.items = toolbarButtons;
  10. [self.view addSubview:toolbar];
  11.  
  12. [toolbar release];

Report this snippet  

You need to login to post a comment.