- (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;
}
问问题
7976 次
2 回答
5
UIImageView *titleLabel = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"nature.jpeg"]];
titleLabel.frame = CGRectMake(0, 0, 120, 40);
titleLabel.contentMode = UIViewContentModeRight;
self.navigationItem.titleView = titleLabel;
于 2012-04-10T06:03:45.173 回答
3
我认为最好的方法是使用 UIImageView contentMode 属性。
你可以这样使用:
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,480)];
imageView.contentMode = UIViewContentModeLeft;
应该没问题。
于 2012-04-10T05:49:28.880 回答