iOS 设置图片出现蓝色块-的处理方案

一、按钮有Normal 与 Select 状态
[UIButton buttonWithType:UIButtonTypeSystem]
1、设置setBackgroundImage
[self setBackgroundImage:[UIImage imageNamed:image] forState:state];
2、设置tintColor
self.audioButton.tintColor = [UIColor clearColor];

当不需要使用按钮的select状态时,只需要这样即可

二、按钮只有Normal状态,只需要一步操作即可以使用系统按钮
[self.audioButton setImage:[[UIImage imageNamed:@"icon_voice_chat"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];

你可能感兴趣的:(iOS 设置图片出现蓝色块-的处理方案)