'UIColor' 没有可见的@interface 声明了选择器 'blendedColorWithFraction:ofColor:'

No visible @interface for 'UIColor' declares the selector 'blendedColorWithFraction:ofColor:'

//// General Declarations
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = UIGraphicsGetCurrentContext();

//// Color Declarations
UIColor* color = [UIColor colorWithRed: 0.623 green: 0.61 blue: 0.61 alpha: 1];

//// Gradient Declarations
CGFloat gradientLocations[] = {0.62, 0.9, 1};
CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, (__bridge CFArrayRef)@[(id)UIColor.whiteColor.CGColor, (id)[UIColor.whiteColor blendedColorWithFraction: 0.5 ofColor: UIColor.blackColor].CGColor, (id)UIColor.blackColor.CGColor], gradientLocations);

我正在使用一个工具,我在其中制作路径并应用渐变。当我将此代码复制粘贴到 Xcode 时,它告诉我没有它不存在。

什么是替代方法,我可以用它来代替这个。

错误截图如下。

谢谢

错误信息是正确的。 blendedColorWithFraction:ofColor: 是一个 NSColor method,不是 UIColor 方法。