【发布时间】:2012-02-13 17:18:06
【问题描述】:
在我的 iPhone 应用程序中,我有以下代码来设置应用程序中横向和纵向标题栏的背景图像。
if ([UINavigationBar respondsToSelector:@selector(appearance)]) {
[[UINavigationBar appearance] setBackgroundImage: [UIImage imageNamed:@"titlebar_landscape.png"] forBarMetrics:UIBarMetricsLandscapePhone];
[[UINavigationBar appearance] setBackgroundImage: [UIImage imageNamed:@"titlebar.png"] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setBackgroundColor: [UIColor redColor]];
}
图片是以渐变背景为中心的应用程序徽标,相应地调整了横向大小。我为我的 iPad 版本的应用程序做了同样的事情,但是横向图像不起作用,因为 iPad 上的横向没有特定的选项,就像 iPhone UIBarMetricsLandscapePhone 上那样。
所以我的问题是如何在我的 iPad 上实现类似的效果,我的应用程序徽标在 iOS5 的横向模式下以渐变背景为中心?
【问题讨论】:
-
Apple Bug:这应该是可能的。如果我们仍然必须手动进行这种黑客攻击,那么外观系统就非常愚蠢(我不知道 Apple 怎么没注意到应用程序在不同的 iPad 方向上使用不同的背景 - Apple 自己做的!)
标签: ios ipad ios5 uinavigationbar