0

长话短说,这就是我得到的:

http://img839.imageshack.us/img839/9461/capturedcran20130418000x.png

这是我的 AppDelegate 中的一些代码:

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"main_bar.png"] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setTitleTextAttributes:
 [NSDictionary dictionaryWithObjectsAndKeys:
  //[UIColor colorWithRed:125.0/255.0 green:111.0/255.0 blue:100.0/255.0 alpha:1.0],
  //UITextAttributeTextColor,
  //[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8],
  //UITextAttributeTextShadowColor,
  //[NSValue valueWithUIOffset:UIOffsetMake(0, 0)],
  //UITextAttributeTextShadowOffset,
  [UIFont fontWithName:@"Pacifico" size:25],
  UITextAttributeFont,
  nil]];
[[UINavigationBar appearance] setTitleVerticalPositionAdjustment:-10 forBarMetrics:UIBarMetricsDefault];

可能是什么问题?

4

1 回答 1

1

我遇到过类似的问题,并使用以下方法将它们整理出来:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.title = @"Home";
        self.tabBarItem.image = [UIImage imageNamed:@"main_bar.png"];
        CGRect frame = CGRectMake(0, 0, 400, 44);
        UILabel *label = [[UILabel alloc] initWithFrame:frame];
        label.backgroundColor = [UIColor clearColor];
        label.font = [UIFont boldSystemFontOfSize:20.0];
        label.shadowColor = [UIFont fontWithName:@"Pacifico" size:25];
        label.textAlignment = UITextAlignmentCenter;
        label.textColor = [UIColor whiteColor];
        self.navigationItem.titleView = label;
        label.text = NSLocalizedString(@"Remindbox", @"");
    }
    return self;
}

您需要稍微调整一下才能使其与您的字体一起使用。希望它有所帮助。

于 2013-04-17T23:10:27.963 回答