UIBarButtonItem *tbarItem = [[UIBarButtonItemalloc] initWithBarButtonSystemItem:UIBarButtonSystemItemActiontarget:selfaction:@selector(book)];
UIBarButtonItem *tbarItem1 = [[UIBarButtonItemalloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAddtarget:selfaction:nil];
UIBarButtonItem *tbarItem3 = [[UIBarButtonItemalloc] initWithTitle:@"title"style:(UIBarButtonItemStyleDone) target:selfaction:nil];
UIBarButtonItem *tbarItem4 = [[UIBarButtonItemalloc] initWithTitle:@"button1"style:(UIBarButtonItemStyleBordered) target:selfaction:nil];
//设置间隔
UIBarButtonItem *flex = [[UIBarButtonItemalloc] initWithBarButtonSystemItem: UIBarButtonSystemItemFixedSpacetarget:selfaction:nil];
NSArray *itemArray=
@[tbarItem,flex,tbarItem1,flex,tbarItem3,flex,tbarItem4];
//默认是隐藏的
[self.navigationControllersetToolbarHidden:NOanimated:YES];
[self setToolbarItems:itemArray];
navigationController and ToolBar,布布扣,bubuko.com
navigationController and ToolBar
原文地址:http://www.cnblogs.com/zhangjl/p/3759321.html