我想用NSAttributedString在我的项目,但是当我试图设置颜色,这是不是从标准组(redColor,blackColor,greenColor等)UILabel显示在白色这些信件.这是我的代码行.
[attributedString addAttribute:NSForegroundColorAttributeName
value:[UIColor colorWithRed:66
green:79
blue:91
alpha:1]
range:NSMakeRange(0, attributedString.length)];
Run Code Online (Sandbox Code Playgroud)
我尝试使用CIColorCore Image框架制作颜色,但它显示了相同的结果.我应该如何更改代码以正确的方式执行它?
伙计们,谢谢!
我正在尝试实现下一个奇怪的事情:我有几个点,我想用正弦波连接它们
下一个方法返回用于制作绘图的点阵列:
- (NSArray *)plotPointsBetweenPoint:(CGPoint)pointA andPoint:(CGPoint)pointB {
double H = fabs(pointB.y - pointA.y);
double L = fabs(pointB.x - pointA.x);
NSInteger granularity = 40;
NSMutableArray *array = [NSMutableArray arrayWithCapacity:granularity + 1];
for (int i = 0; i <= granularity; ++i) {
CGFloat x = M_PI*(float)i/(granularity);
CGFloat y = -cosf(x);
CGFloat multiplier = pointA.y > pointB.y ? 1 : -1;
CGPoint newPoint = CGPointMake(pointA.x + L*(float)i/granularity, pointA.y - multiplier*H*(1.0 + y)/2.0);
[array addObject:[NSValue valueWithCGPoint:newPoint]];
}
return array;
}
Run Code Online (Sandbox Code Playgroud)
之后我创建了特殊的UIBezierPath:
- …Run Code Online (Sandbox Code Playgroud)