长话短说,这就是我得到的:
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];
可能是什么问题?
最佳答案
我也遇到过类似的问题,并通过使用类似的方法进行了整理:
- (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;
}
您需要花些时间才能使其与您的字体一起使用。希望它会有所帮助。