Objective c UINavigationBar样式问题?

Objective c UINavigationBar样式问题?,objective-c,uinavigationcontroller,uinavigationbar,Objective C,Uinavigationcontroller,Uinavigationbar,我有一个UINavigationBar我有风格问题。首先,我使用这段代码(导航控制器中的一个类)来设置UINavigationBar的样式 #import... @implementation UINavigationBar (UINavigationBarCustomDraw) - (void) drawRect:(CGRect)rect { [self setTintColor:[UIColor colorWithRed:0.9f green: 0.9f blue:0.9f alpha

我有一个UINavigationBar我有风格问题。首先,我使用这段代码(导航控制器中的一个类)来设置UINavigationBar的样式

#import...

@implementation UINavigationBar (UINavigationBarCustomDraw)

- (void) drawRect:(CGRect)rect {

[self setTintColor:[UIColor colorWithRed:0.9f green: 0.9f blue:0.9f alpha:1]];

if ([self.topItem.title length] > 0 && ![self.topItem.title isEqualToString:@"Back to ..."]) {
    [[UIImage imageNamed:@"UINavigationBar_background.png"] drawInRect:rect];

    CGRect frame = CGRectMake(0, 0, 320, 44);
    UILabel *label = [[[UILabel alloc] initWithFrame:frame] autorelease];
    [label setBackgroundColor:[UIColor clearColor]];
    label.font = [UIFont boldSystemFontOfSize: 20.0];
    label.shadowColor = [UIColor clearColor];
    label.textAlignment = UITextAlignmentCenter;
    label.textColor = [UIColor colorWithRed:(70.0 / 255.0) green:(70.0 / 255.0) blue:(70.0 / 255.0) alpha: 1];
    label.text = self.topItem.title;
    self.topItem.titleView = label;

} else {
    //[[UIImage imageNamed:@"login_button.png"] drawInRect:rect];
    self.topItem.titleView = [[[UIView alloc] init] autorelease];
}
}

@end

@implementation...
以下是我的两个问题:

  • 当我在另一个具有不同形式和样式的文档中应用此代码时,它会更改所有内容。为什么会这样
  • 从一个视图移动到另一个视图时,textColor将变为白色。它显示了伟大的启动,当我回到导航控制器,它的工作良好
提前谢谢

PS:如果你需要更多的代码,请询问