Tag: 颜色

iOS SpriteKit如何使笔画颜色透明?

我现在使用SpriteKit做一些简单的游戏。 绘画过程中有笔画颜色的问题。 我必须做我的彩色shapeNode透明,但我的笔触颜色保持不变每次。 我已经尝试了不同的技术来完成我的节点是完全透明的:1)将alpha组件设置为笔触颜色2)将alpha组件设置为整个节点。 它没有帮助。 有什么方法可以实现或解决这个问题吗? 创build我的节点 CGMutablePathRef arc = CGPathCreateMutable(); cardWidth = cardWidth + cardAlpha; CGPathAddRoundedRect(arc, NULL, CGRectMake(-cardWidth/2, -cardHeight/2, cardWidth, cardHeight), roundRadius, roundRadius); roundRect = [SKShapeNode node]; roundRect.name = self.name; CGFloat lineWidth = 2.0; CGPathRef strokedArc = CGPathCreateCopyByStrokingPath(arc, NULL, lineWidth, kCGLineCapButt, kCGLineJoinMiter, // the default 10); // 10 is default miter limit roundRect.path = […]

iPhone的iOS UILabel如何自定义文本颜色的UITableView细节文本标签只?

我正在制作一个界面原型,并正在使用一个故事板来做到这一点。 部分原型涉及将UITableView单元格的详细UILabel设置为某种颜色。 我想避免在故事板中手动重新着色每个标签。 我发现我可以使用: [[UILabel appearanceWhenContainedIn:[UITableViewCell class], nil] setTextColor:[UIColor cyanColor]]; 改变tableview单元格中标签的外观。 有没有办法进一步完善这个代码只适用于详细tableview标签? 目前它改变了UITableViewCell的textLabel和detailTextLabel。 谢谢!

我该如何解决这个YCrCb – > RBG转换公式?

我使用这个问题的公式: uint8_t *rgbBuffer = malloc(imageWidth * imageHeight * 3); // .. iterate over height and width // from ITU-R BT.601, rounded to integers rgbOutput[0] = (298 * (y – 16) + 409 * cr – 223) >> 8; rgbOutput[1] = (298 * (y – 16) + 100 * cb + 208 * cr + 136) […]

检测iPhone / iPod的颜色

可能重复: 检测iPhone / iPod touch的颜色? 是否可以在本地或在手机浏览器中检测iPhone / iPod的颜色? 我正在和一个喜欢让networking应用程序响应设备颜色的devise师合作。

更改UIPicker的颜色

我怎样才能改变我的select器的颜色? 我不想改变字体或文字。 我的select器是填充和工作正是我想要的,我想要做的是将颜色从黑色更改为我自定义的白色。

从一个UIColor手动颜色渐变到另一个

我试图在drawRect淡入一个UIColor到另一个UIColor 。 我创build了这个函数来计算一定比例的颜色: – (UIColor *)colorFromColor:(UIColor *)fromColor toColor:(UIColor *)toColor percent:(float)percent { float dec = percent / 100.f; CGFloat fRed, fBlue, fGreen, fAlpha; CGFloat tRed, tBlue, tGreen, tAlpha; CGFloat red, green, blue, alpha; if(CGColorGetNumberOfComponents(fromColor.CGColor) == 2) { [fromColor getWhite:&fRed alpha:&fAlpha]; fGreen = fRed; fBlue = fRed; } else { [fromColor getRed:&fRed green:&fGreen blue:&fBlue alpha:&fAlpha]; } if(CGColorGetNumberOfComponents(toColor.CGColor) […]

远处的颜色检测(Swift)

有人能指出我在正确的方向与远处的颜色检测? 我已经使用了下面的代码,如果一个对象或兴趣点距离不到10英尺,它会正确地抓取图像的RBG值。 当对象在远处时,代码返回错误的值。 我想拍摄距离大于10英尺的物体的照片,并检测该图像的颜色。 //On the top of your swift extension UIImage { func getPixelColor(pos: CGPoint) -> UIColor { let pixelData = CGDataProviderCopyData(CGImageGetDataProvider(self.CGImage)) let data: UnsafePointer<UInt8> = CFDataGetBytePtr(pixelData) let pixelInfo: Int = ((Int(self.size.width) * Int(pos.y)) + Int(pos.x)) * 4 let r = CGFloat(data[pixelInfo]) / CGFloat(255.0) let g = CGFloat(data[pixelInfo+1]) / CGFloat(255.0) let b = CGFloat(data[pixelInfo+2]) […]

iOS UINavigationBar色彩颜色比颜色集显得更暗

我正在为特定的导航控制器设置自定义外观: //Set Cutom Nav Bar Appearance [[UINavigationBar appearanceWhenContainedIn:[MyNavigationControllerClass class], nil] setBackgroundImage: nil forBarMetrics: UIBarMetricsDefault]; [[UINavigationBar appearanceWhenContainedIn:[MyNavigationControllerClass class], nil] setBarTintColor: self.tableView.backgroundColor]; 当显示导航控制器时,预期的颜色是RGB(247,247,247) – 我已经仔细检查过的也是当设置该值时tableView.background颜色的值 – 但它在屏幕上显示为RGB(227 ,227,227)。 UINavigationBar外观代理的不同属性可以改变屏幕上显示的颜色吗? 谢谢! 编辑: 此外,如果我直接使用所需的颜色设置barTintColor,屏幕上显示的barTintColor仍比预期的要暗: UIColor* navBarBackgroundColor = [UIColor colorWithRed: (247.0 / 255.0) green: (247.0 / 255.0) blue: (247.0 / 255.0) alpha: 1]; //Set Cutom Nav Bar Appearance [[UINavigationBar appearanceWhenContainedIn:[MyNavigationControllerClass […]

NSAttributedString在string末尾改变颜色

这一定是一件容易的事,但我无法弄清楚。 我有一个NSMutableAttributedString,例如,“这是一个testing”。 我想给“testing”一词涂上蓝色,我这样做: NSMutableAttributedString *coloredText = [[NSMutableAttributedString alloc] initWithString:@"This is a test"]; [coloredText addAttribute:NSForegroundColorAttributeName value:[UIColor blueColor] range:NSMakeRange(10,4)]; 这工作得很好。 但是现在我想把文本颜色设置为黑色,以便在“testing”之后input任何东西。 如果我做: [coloredText addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(coloredText.string.length, 1)]; 我得到一个objectAtIndex:effectiveRange:越界的错误。 假定范围超出了string的长度。 如果我做: [coloredText addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(coloredText.string.length, 0)]; 错误消失,但在“testing”之后键入仍然是蓝色的。 如何在插入点处设置当前颜色? 欢呼任何input。

如何在iOS / ObjectiveC中获取TouchPoint的坐标和像素颜色

我需要在Objective-C中获得TouchPoint的Coordinates和PixelColor。 这甚至有可能吗? 如果是的话,我会对如何正确的方向或任何暗示非常感兴趣。 感谢名单!