Reputation: 21
- (void)viewDidLoad
{
[super viewDidLoad];
[self setTitle:@"myTitle"];
UIImageView *titleLabel = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"myImage.PNG"]];
titleLabel.frame = CGRectMake(0, 0, 120, 40);
self.navigationItem.titleView = titleLabel;
}
Upvotes: 0
Views: 8254
Reputation: 2218
UIImageView *titleLabel = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"nature.jpeg"]];
titleLabel.frame = CGRectMake(0, 0, 120, 40);
titleLabel.contentMode = UIViewContentModeRight;
self.navigationItem.titleView = titleLabel;
Upvotes: 5
Reputation: 2502
I think the best is to use UIImageView contentMode property.
You can use like this:
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,480)];
imageView.contentMode = UIViewContentModeLeft;
It should be ok.
Upvotes: 3