如何使UIToolbar字体与UINavigation Controller匹配?

时间:2009-04-20 15:16:22

标签: iphone uinavigationcontroller uilabel uitoolbar

使用the following post,我能够将UILabel添加到UIToolbar,但是,它看起来很糟糕。任何人都知道如何获取文本大小/颜色/阴影以匹配UINavigationController的标题?

导航控制器

alt text http://www.codingwithoutcomments.com/uploads/Picture1.png

带UILabel的UIToolbar

alt text http://www.codingwithoutcomments.com/uploads/Picture2.png

我需要采取哪些步骤才能使它们匹配?

3 个答案:

答案 0 :(得分:7)

您可能还想添加阴影?

itemLabel.shadowColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
itemLabel.shadowOffset = CGSizeMake(0, -1.0);

答案 1 :(得分:3)

显然问题是关于iPhone,但如果有人想知道,这里有iPad的数字:

    titleLabel.font = [UIFont boldSystemFontOfSize:20.0];
    titleLabel.shadowOffset = CGSizeMake(0, 1);
    titleLabel.shadowColor = [UIColor colorWithWhite:1.f alpha:.5f];
    titleLabel.textColor = [UIColor colorWithRed:113.f/255.f green:120.f/255.f blue:127.f/255.f alpha:1.f];
    titleLabel.backgroundColor = [UIColor clearColor];
    titleLabel.text = @"Title";

答案 2 :(得分:0)

UILabel * itemLabel = [[UILabel alloc] initWithFrame:rectArea];
itemLabel.text = @"Item";   
itemLabel.textColor = [UIColor whiteColor];
itemLabel.font = [UIFont boldSystemFontOfSize:22.0];