【发布时间】:2013-09-25 07:38:11
【问题描述】:
我的 uiviewcontroller 中有以下代码嵌入在 uinavigationcontroller 中。
在 viewDidLoad 中:
[self addLogo];
下面:
- (void) addLogo
{
UIImage *image = [UIImage imageNamed:@"logoblack.png"];
UIImageView *myImageView = [[UIImageView alloc] initWithImage:image];
myImageView.frame = CGRectMake(0, 0, 30, 30);
myImageView.layer.cornerRadius = 5.0;
myImageView.layer.masksToBounds = YES;
myImageView.layer.borderColor = [UIColor lightGrayColor].CGColor;
myImageView.layer.borderWidth = 0.1;
self.navigationItem.titleView = myImageView;
}
我拥有的图像是 434 x 434,但我希望它是 30 x 30。相反,它被拉伸并超过了导航栏中的
【问题讨论】:
-
为什么不在预览应用程序中缩放和调整图像大小并添加 30X30 帧 - 不要认为它很复杂
-
是的,我会这样做,只是想了解更多有关 iOS api 的信息
-
你有没有尝试改变titleView的contentMode。对 UIViewContentModeBottom 说。
标签: ios uinavigationcontroller uinavigationbar ios7