I
I had the same problem in my last project, you can create a new logo.png which dimension is equal to 500*88 pixels, make you logo in the left side of it. filled with transparent color from the rest of the png.
UIImageView *titleImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logoName_500.png"]];
[titleImageView setFrame:CGRectMake(0, 0, 250, 44)];
self.navigationItem.titleView = titleImageView;
hope this helpful.
@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;