给UIBarButtonItem设置字体大小和颜色

UIBarButtonItem *rightBtn = [[UIBarButtonItem alloc]initWithTitle:@"查看商品" style:(UIBarButtonItemStylePlain) target:self action:@selector(rightBtnAction)];
// 字体颜色
[rightBtn setTintColor:[UIColor redColor]
 ];
// 字体大小
[rightBtn setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont boldSystemFontOfSize:12], NSFontAttributeName,nil] forState:(UIControlStateNormal)];
self.navigationItem.rightBarButtonItem = rightBtn;

你可能感兴趣的:(给UIBarButtonItem设置字体大小和颜色)