@link @luvieere tarafından verilen kod aşağıda belirtilmiştir. sadece iOS 5 gibi @implementation rootviewController
@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed:@"NavigationBar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
yukarıdaki rootview kontrolöre içine bu kodu yapıştırın Bunu yapmak için resmi bir yolu yoktur. Eğer gerçekten iOS 4 ve aşağıdaki hendek istemedikçe geriye dönük uyumluluk için eski kodu korumak, hala
// someplace where you create the UINavigationController
if ([navigationController.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]) {
UIImage *image = [UIImage imageNamed:@"NavigationBar.png"];
[navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
}
Ama (iOS Developer Library bakınız).
Bu kodları tercih ediyorum çünkü kategoriler kullanım önerilmiyor! Kullanırsanız iyi çalıştığını göreceksiniz. – Steve