修改rightBarButtonItem字体颜色

从各方寻到下面方法:


UIBarButtonItem*rightitem = [[UIBarButtonItemalloc] initWithTitle:@"确定"style:(UIBarButtonItemStyleDone) target:selfaction:@selector(moreConfig:)];

self.navigationItem.rightBarButtonItem = rightitem;[self.navigationItem.rightBarButtonItem setTintColor:[UIColorredColor]];


但是我尝试并没有成功,尝试下面的方式成功实现想要的效果:


UIBarButtonItem *rightitem = [[UIBarButtonItem alloc]initWithTitle:@"确定"style:(UIBarButtonItemStyleDone)target:selfaction:@selector(moreConfig:)];

NSDictionary *dic =[NSDictionarydictionaryWithObject:DRGBCOLOR(44,163,255,1)forKey:NSForegroundColorAttributeName];[rightitemsetTitleTextAttributes:dicforState:UIControlStateNormal];

self.navigationItem.rightBarButtonItem = rightitem;


你可能感兴趣的:(修改rightBarButtonItem字体颜色)