iOS7 和 iOS8 中的 UINavigationBar 外观不同
UINavigationBar appearance different in iOS7 and iOS8
以下代码在 iOS8 上完美运行,但在 iOS7 上有一个奇怪的行为。
[[UINavigationBar appearance] setBackIndicatorImage:[UIImage imageNamed:@"icone retour@2x.png"]];
[[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:[UIImage imageNamed:@"icone retour@2x.png"]];
见下图。有什么想法吗?
您不应直接引用图像的 @2x 或 @3x 版本,而应仅引用 "base" 名称并让 iOS 自动确定当前设备的正确变体:
[UIImage imageNamed:@"icone retour.png"]
关于 iOS7 与 iOS8 中的不同行为,我只能推测 iOS8 改变了 imageNamed:
中关于比例的行为传递名称中带有 @2x
或 @3x
的图像时返回的 UIImage
。但是你通常不应该这样做。
以下代码在 iOS8 上完美运行,但在 iOS7 上有一个奇怪的行为。
[[UINavigationBar appearance] setBackIndicatorImage:[UIImage imageNamed:@"icone retour@2x.png"]];
[[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:[UIImage imageNamed:@"icone retour@2x.png"]];
见下图。有什么想法吗?
您不应直接引用图像的 @2x 或 @3x 版本,而应仅引用 "base" 名称并让 iOS 自动确定当前设备的正确变体:
[UIImage imageNamed:@"icone retour.png"]
关于 iOS7 与 iOS8 中的不同行为,我只能推测 iOS8 改变了 imageNamed:
中关于比例的行为传递名称中带有 @2x
或 @3x
的图像时返回的 UIImage
。但是你通常不应该这样做。