私は以下のコード・スニペットを持っている:私はそれを置くiPhoneのナビゲーションバーをXcodeでどのようにカスタマイズできますか?
1)
[[UINavigationBar appearance] setBackgroundImage:myImage forBarMetrics:UIBarMetricsDefault];
?私はそれを置く
または2)
@implementation UINavigationBar (BackgroundImage)
//This overridden implementation will patch up the NavBar with a custom Image instead of the title
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"NavigationBar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
?
私はviewcontrollerにナビゲーションバーを追加しようとしましたが、これらのコードをどこに配置するのか正確にはわかりません。
また、あなたがカスタマイズする必要があるだろうか尋ねる、用ナビ全色/バー/ titleImage ...等を変更すると言うことができます – Splendid
質問が重複しているようで、次のスレッドを参照することができます - http://stackoverflow.com/questions/704558/custom-uinavigationbar-background – rishi