在我的iPhone應用程序中,我有以下代碼爲應用程序中的橫向和縱向標題欄設置背景圖像。在UINavigationBar中的景觀居中標誌在iPad上
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
。
所以我的問題是如何在iOS5中以橫向模式中的漸變背景爲中心的我的應用徽標的iPad上實現類似效果?
Apple Bug:這應該是可以的。如果我們仍然需要手動進行這種黑客行爲(我不知道蘋果公司是如何注意到應用程序在不同的iPad方向上使用不同背景的 - 蘋果公司自己做的!),那麼外觀系統非常愚蠢! – Adam 2012-05-10 19:33:20