#import "RootViewController.h"
@interface RootViewController ()
@end
@implementation RootViewController
- (void)viewDidLoad {
[super viewDidLoad];
//显示toolbar
//self.navigationController.toolbarHidden = NO;
//动画效果
[self.navigationController setToolbarHidden:NO animated:YES];
//背景颜色
self.navigationController.toolbar.barTintColor = [UIColor redColor];
//渲染颜色
self.navigationController.toolbar.tintColor = [UIColor orangeColor];
//设置背景图片
[self.navigationController.toolbar setBackgroundImage:[UIImage imageNamed:@"123.jpg"] forToolbarPosition:UIBarPositionBottom barMetrics:UIBarMetricsDefault];
UIBarButtonItem *item1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(handle:)];
UIBarButtonItem *item2 = [[UIBarButtonItem alloc] initWithTitle:@"保存" style:UIBarButtonItemStylePlain target:self action:@selector(handle:)];
UIBarButtonItem *item3 = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"234.jpg"] style:UIBarButtonItemStylePlain target:self action:@selector(handle:)];
UIBarButtonItem *item4 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:@selector(handle:)];
//UIBarButtonItem *item4 = []
self.toolbarItems = @[item1,item4,item2,item4,item3,item4];
// UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(20, 100, 300, 30)];
// [self.view addSubview:toolBar];
// toolBar.backgroundColor = [UIColor redColor];
// toolBar.items = @[item1,item2];
}
- (void)handle:(UIBarButtonItem *)item{
NSLog(@"gogogogo");
}
@end