
I
@property(nonatomic,strong) UIView *titleImageView;
- (UIView *)titleImageView {
if (!_titleImageView) {
CGFloat width = self.view.frame.size.width;
_titleImageView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, 44)];
[self.titleLabelView setBackgroundColor:[UIColor clearColor]];
UIImage *img = [UIImage imageNamed:@"myImg"];
UIImageView *imgView = [[UIImageView alloc] initWithImage:img];
CGRect imageViewRect = imgView.frame;
/*
//adjust image position if you need
imageViewRect.x = 10;
imageViewRect.y = 3;
imageView.frame = imageViewRect;
*/
[_titleLabelView addSubview:imgView];
}
return _titleLabelView;
}
self.navigationItem.titleView = self.titleLabelView;