UIButton *titleBtn = [[UIButton alloc] init];
[titleBtn setFont:[UIFont systemFontOfSize:18.0f]];
[titleBtn setTitle:@"所有照片" forState:0];
[titleBtn setTitleColor:[UIColor blackColor] forState:0];
[titleBtn setImage:[UIImage imageNamed:@"content_image_nextwhite_nor"] forState:UIControlStateNormal];
[titleBtn setImage:[UIImage imageNamed:@"content_image_next_nor"] forState:UIControlStateHighlighted];
UIFont *font = [UIFont systemFontOfSize:18.0f];
CGFloat maxWidth = self.view.width - 100;
CGSize size = CGSizeMake(maxWidth, MAXFLOAT);
CGSize theStringSize = [@"所有照片" sizeWithFont:font
constrainedToSize:size
lineBreakMode:NSLineBreakByWordWrapping];
titleBtn.frame = CGRectMake(0, 0, theStringSize.width + 50, 40);
[titleBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, -20 - 2, 0, 20 + 2)];//20为下拉图片宽度
[titleBtn setImageEdgeInsets:UIEdgeInsetsMake(0, theStringSize.width + 2, 0, -theStringSize.width - 2)];
titleBtn.backgroundColor = [UIColor grayColor];
self.navigationItem.titleView = titleBtn;