OC不更换图片修改按钮图片颜色

原创
2019/12/14 14:18
阅读数 225
    UIButton *barbutton = [[UIButton alloc] init];
    UIImage *image = [[UIImage imageNamed:@"zhige_chat_back"]imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];

    [barbutton setImage:image forState:UIControlStateNormal];
    barbutton.titleLabel.font = [UIFont systemFontOfSize:17.0f];
    [barbutton addTarget:self action:@selector(dismissView) forControlEvents:UIControlEventTouchUpInside];
    barbutton.tintColor = text_color;//需要的颜色
    [barbutton sizeToFit];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:barbutton];

 

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部