// 配置右上角在线按钮
UIButton *onlineBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 100, 40)];
[onlineBtn addTarget:self action:@selector(onlineAction:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *rightBtn = [[UIBarButtonItem alloc] initWithCustomView:onlineBtn];
UIBarButtonItem *space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
space.width = -20;//自己设定
// self.navigationItem.rightBarButtonItem = rightBtn;
self.navigationItem.rightBarButtonItems = @[space, rightBtn];
leftItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
UIBarButtonItem *space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
space.width = -11;//自己设定
[self.navigationItem setLeftBarButtonItems:[NSArray arrayWithObjects:space,leftItem, nil]];