Can\'t seem to find a tutorial which does as the question title describes. I\'d like to understand just where the UIToolbar needs to be declared and how to get it onto my vi
To show the Toolbar at the bottom with space between two button on at Left Side , and another at Right side
-(void)showToolBar
{
CGRect frame, remain;
CGRectDivide(self.view.bounds, &frame, &remain, 44, CGRectMaxYEdge);
UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:frame];
UIBarButtonItem *button1 = [[UIBarButtonItem alloc] initWithTitle:@"Send" style:UIBarButtonItemStyleDone target:self action:nil];
UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
UIBarButtonItem *button2=[[UIBarButtonItem alloc]initWithTitle:@"Cancel" style:UIBarButtonItemStyleDone target:self action:nil];
[toolbar setItems:[[NSArray alloc] initWithObjects:button1,spacer,button2,nil]];
[toolbar setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin];
[self.view addSubview:toolbar];
}
Note: To Give space between to Button we add line as below
UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
and add spacer to the
[toolbar setItems:[[NSArray alloc] initWithObjects:button1,spacer,button2,nil]];