navigationItem titleView - 徽标太大 iPhone6+
navigationItem titleView - Logo too big for iPhone6+
我正在导航栏中添加徽标。
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"00-logo"]];
self.navigationItem.titleView = imageView;
在 iPhone4S、iPhone5S 上看起来不错,iPhone6 但在 iPhone6+ 中它有点太大,因此导航栏下方有一些像素。
我试过:
[self.navigationItem.titleView sizeToFit];
但是还是不行。
我用于徽标的图片是:
- 00-标志@2x.png - 203x72.
- 00-标志@3x.png - 393x138.
与 2x 图片相比,您的 3x 图片尺寸错误。
请记住,如果 1x 图像是 w x h 像素,则 2x 图像必须是 2w x 2h 像素,3x 图像必须是 3w x 3h 像素。
给定您的 203 x 72 的 2x 图片,您的 3x 图片必须是 304.5 x 108 像素,而不是 393 x 138。
请注意,2x 图片的宽度和高度应该是均匀的。
我正在导航栏中添加徽标。
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"00-logo"]];
self.navigationItem.titleView = imageView;
在 iPhone4S、iPhone5S 上看起来不错,iPhone6 但在 iPhone6+ 中它有点太大,因此导航栏下方有一些像素。
我试过:
[self.navigationItem.titleView sizeToFit];
但是还是不行。
我用于徽标的图片是:
- 00-标志@2x.png - 203x72.
- 00-标志@3x.png - 393x138.
与 2x 图片相比,您的 3x 图片尺寸错误。
请记住,如果 1x 图像是 w x h 像素,则 2x 图像必须是 2w x 2h 像素,3x 图像必须是 3w x 3h 像素。
给定您的 203 x 72 的 2x 图片,您的 3x 图片必须是 304.5 x 108 像素,而不是 393 x 138。
请注意,2x 图片的宽度和高度应该是均匀的。