UIButton *btnRightBar=[UIButton buttonWithType:UIButtonTypeSystem];
btnRightBar.frame=CGRectMake(0, 0, 30, 30);
UIImage *image=[UIImage imageNamed:@"ic_chat_connect"];
image=[image stretchableImageWithLeftCapWidth:floorf(20) topCapHeight:20];
[btnRightBar setBackgroundImage:image forState:UIControlStateNormal];
btnRightBar.contentEdgeInsets=UIEdgeInsetsMake(5, 5, 5, 5);
[btnRightBar addTarget:self action:@selector(rightItemAction) forControlEvents:UIControlEventTouchUpInside];
btnRightBar.backgroundColor=[UIColor redColor];
self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc] initWithCustomView:btnRightBar];