自定义工具栏,可以创建多个Item。
//创建工具栏
[self.navigationController setToolbarHidden:NO animated:YES];
[self.navigationController.toolbar setBarStyle:UIBarStyleDefault];
self.navigationController.toolbar.frame=CGRectMake(0, [UIScreen mainScreen].bounds.size.height-44, [UIScreen mainScreen].bounds.size.width, 44);
UIBarButtonItem *spaceItem = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:nil action:nil];
UIBarButtonItem *customItem1 = [[UIBarButtonItem alloc]
initWithTitle:@"预览" style:UIBarButtonItemStyleDone
target:self action:@selector(toolBarItem1:)];
UIBarButtonItem *customItem2 = [[UIBarButtonItem alloc]
initWithTitle:@"确定" style:UIBarButtonItemStyleDone
target:self action:@selector(toolBarItem2:)];
NSArray *arr1 = [[NSArray alloc]initWithObjects:customItem1,spaceItem,customItem2, nil];
self.toolbarItems = arr1;
[super viewDidLoad];
参考:http://www.runoob.com/ios/att-ios-ui-toolbar.html