我想在用户触摸时更改图像视图的颜色。我不需要它来改变很多。但是,我希望它变成一片蓝色。我发现下面的代码来改变渐变,但它没有任何效果。实际上,我不需要渐变,只有色调。将不胜感激任何建议。iOS/Objective-C:更改图像视图的色调
UIView *snapshot = [[UIImageView alloc] initWithImage:image];
snapshot.layer.masksToBounds = NO;
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.colors = @[(id)[UIColor redColor].CGColor, (id)[UIColor blackColor].CGColor];
[snapshot.layer insertSublayer:gradient atIndex:0];
'someView.backgroundColor = [的UIColor blueColor];' – danh