调试 UIBezierPath
我正在努力显示我在代码中生成的 UIBezierPath
,因此在尝试调试它时,我想打印它所绘制的坐标。我在任何地方都找不到这种技术。鉴于下面的代码,有人可以分享这个吗?
谢谢
UIBezierPath* beizerPath2 = [UIBezierPath bezierPath];
[beizerPath2 moveToPoint:CGPointMake(0.0, 167)];
[beizerPath2 addLineToPoint:CGPointMake(100, 40)];
[beizerPath2 addLineToPoint:CGPointMake(200, 70)];
[beizerPath2 addLineToPoint:CGPointMake(300, 30)];
[beizerPath2 addLineToPoint:CGPointMake(320, 30)];
[beizerPath2 addLineToPoint:CGPointMake(320, 167)];
[beizerPath2 closePath];
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.path = [beizerPath2 CGPath];
//print Bezier/Path co-ordinates here.
I'm struggling to display a UIBezierPath
that I generate in code, so in my attempt to debug it, I want to print the coordinates it is plotted on. I can't find this technique anywhere. Can someone share this, given the code below?
Thanks
UIBezierPath* beizerPath2 = [UIBezierPath bezierPath];
[beizerPath2 moveToPoint:CGPointMake(0.0, 167)];
[beizerPath2 addLineToPoint:CGPointMake(100, 40)];
[beizerPath2 addLineToPoint:CGPointMake(200, 70)];
[beizerPath2 addLineToPoint:CGPointMake(300, 30)];
[beizerPath2 addLineToPoint:CGPointMake(320, 30)];
[beizerPath2 addLineToPoint:CGPointMake(320, 167)];
[beizerPath2 closePath];
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.path = [beizerPath2 CGPath];
//print Bezier/Path co-ordinates here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定“绘制的坐标”是什么意思。您可以使用 -bounds 方法获取路径的最小外接矩形。
当您正在调试并想要使用 NSLog() 时,也不要忽视非常有用的 NSString 宏,例如 NSStringFromCGRect(),例如,
如果我误解了您的问题,请澄清。
Not sure what you mean by "co-ordinates it is plotted on." You can get the minimum bounding rectangle for a path with the -bounds method.
When you are debugging and want to use NSLog(), also don't overlook the very helpful NSString macros, such as NSStringFromCGRect(), e.g.
If I misunderstood your question, please clarify.