如何转换RGB到HSV在可可触摸?(How do I convert RGB into HSV in

2019-09-17 02:23发布

我想设置使用HSV而不是RGB标签的背景色。 如何落实到代码呢?

码:

//.m file

#import "IBAppDelegate.h"

@implementation IBAppDelegate


@synthesize label;

{
self.label.backgroundColor = [UIColor colorWithRed:1.0f
                                             green:0.8f
                                              blue:0.0f
                                             alpha:1.0f];
}

Answer 1:

您可以使用以下便捷构造UIColor对象:

+ (UIColor *)colorWithHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha


文章来源: How do I convert RGB into HSV in Cocoa Touch?