//單個自定義按鈕
UIButton *button =[UIButton buttonWithType:UIButtonTypeCustom];
button.frame =CGRectMake(0, 0, 50, 50);
UIBarButtonItem*Button = [[UIBarButtonItem alloc] initWithCustomView:button];
self.navigationItem.leftBarButtonItem = Button;
//多個按鈕
UIBarButtonItem *btn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay target:self action:@selector(click:)];
UIBarButtonItem btnOne = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPause target:self action:@selector(click1:)];
[self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects:btn,btnOne,nil]];
//自定義View上随意放置button
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(kWidth * 4 / 5, 0, 75, 30)];
//分享按鈕
UIButton *sharebutton = [UIButton buttonWithType:(UIButtonTypeCustom)];
sharebutton.frame = CGRectMake(5, 0, 30, 30);
[view addSubview:sharebutton];
//收藏按鈕
self.collectbutton = [UIButton buttonWithType:(UIButtonTypeCustom)];
self.collectbutton.frame = CGRectMake(45, 0, 30, 30);
[view addSubview:self.collectbutton];
UIBarButtonItem *collectItem = [[UIBarButtonItem alloc] initWithCustomView:view];
self.navigationItem.rightBarButtonItem = collectItem;