更改工具栏颜色和字体IOS 9

时间:2015-08-06 17:02:57

标签: ios objective-c iphone uitoolbar ios9

我的故事板上有一个工具栏,想要更改颜色和Delea源。使用下面的代码我adciocei我可以改变颜色,但字体不会改变。怎么了?我的来源应该是“proximaNova-Bold”

- (void)viewDidLoad {
    [super viewDidLoad];
    [self registerCellNamed:@"DeviceLostHeaderCell"];
    [self registerCellNamed:@"DeviceLostDescriptionCell"];
    [self registerCellNamed:@"DeviceLostPhotoCell"];

    NSDictionary *attributes = @{NSForegroundColorAttributeName : [UIColor colorWithRed:82/255.0 green:157/255.0  blue:230/255.0  alpha:1.0], NSForegroundColorAttributeName : [UIFont fontWithName:@"HelveticaNeue-Bold" size:17.0]};

    NSDictionary *attributes2 = @{NSForegroundColorAttributeName : [UIColor redColor], NSForegroundColorAttributeName : [UIFont fontWithName:@"proximaNova-Regular" size:17.0]};


    [self.rigthToolbarItem setTitleTextAttributes:attributes
                            forState:UIControlStateNormal];
    [self.leftTollbarItem setTitleTextAttributes:attributes2
                                         forState:UIControlStateNormal];
    self.dataTableView.separatorStyle = UITableViewCellSeparatorStyleNone;

}

这是我的工具栏:

enter image description here

1 个答案:

答案 0 :(得分:0)

主要问题是您使用密钥public static void Analyze(string sourceCode) { var tree = CSharpSyntaxTree.ParseText(sourceCode); tree./* ??? What goes here? */ } 并将其设置为字体,而您应该使用NSForegroundColorAttributeName

NSFontAttributeName