我有来自服务器的颜色代码,我使用该颜色来设置UIView的颜色。现在我想设置UIView的边框,其颜色比我得到的颜色更暗(强度更高)。这怎么可能 ?请告诉我,如果您有任何想法,请告诉我。
view.backgroundColor = [view setColor].CGColor;
view.layer.borderWidth = 1.5;
const CGFloat* components = CGColorGetComponents(view.setColor.CGColor);
NSLog(@"Red: %f", components[0]);
NSLog(@"Green: %f", components[1]);
NSLog(@"Blue: %f", components[2]);
NSLog(@"Alpha: %f", CGColorGetAlpha(view.setColor.CGColor));
/*need to set this border color as a dark color*/<br>
view.layer.borderColor = [view setColor].CGColor;
答案 0 :(得分:3)
将每个颜色值降低一个档次。像
这样的东西 [UIColor colorWithRed:oldRed*0.75f green:oldGreen*0.75f blue:oldBlue*0.75f alpha:1.0]