如何在UIView内部实现色轮?
我搜索了网站,找到了如何绘制色轮...... 色轮背后的数学
但我想通过在 UIView 上绘图来实现它。但是我该如何使用 Quartz 技术呢?我应该用点还是线来绘制?谢谢
I searched the web site, and I found how to draw a color wheel...
Math behind the Colour Wheel
But I would like to implement it by drawing on the UIView. But how can I do using the Quartz technology? I should draw from by dots or lines? Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许它对你有用。
-(void)drawPoint:(CGPoint)点{
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), point.x, point.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), point.x, point.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
-
(void)drawLineFrom:(CGPoint)start
到:(CGPoint)结束{
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), start.x, start.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), end.x, end.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
将
UIColor* backColor = [UIColor colorWithPatternImage:your_image_from_cgcontext];
view.backgroundColor = 背景颜色;
Maybe its use for you.
-(void) drawPoint:(CGPoint)point {
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), point.x, point.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), point.x, point.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
}
-(void) drawLineFrom:(CGPoint)start
to:(CGPoint)end {
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), start.x, start.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), end.x, end.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
}
UIColor* backColor = [UIColor colorWithPatternImage:your_image_from_cgcontext];
view.backgroundColor = backColor;