设置图片颜色
2021-07-01 本文已影响0人
ImmortalSummer
UIImageView *iv = [[UIImageView alloc] initWithFrame:CGRectMake(100, 200, 40, 40)];
iv.image = [[UIImage imageNamed:@"en_search_icon"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[self.view addSubview:iv];
iv.tintColor = [UIColor yellowColor];
将图片的RenderingMode
设置为UIImageRenderingModeAlwaysTemplate
,图片的颜色将完全依赖视图的tintColor