直线在180度路径中时出现意外的LineJoinStyle行为

直线在180度路径中时出现意外的LineJoinStyle行为

本文介绍了直线在180度路径中时出现意外的LineJoinStyle行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当一行刚好回到上一行时,我在UIBezierPath中得到了一个裁剪的LineJoin。如果我将第二行调整一个像素,则LineJoin的行为将达到预期。代码如下:

I'm getting a clipped LineJoin in a UIBezierPath when one line comes back exactly over the previous line. If I adjust the second line by one pixel, the LineJoin behaves as expected. Here's the code:

UIBezierPath *path = [UIBezierPath bezierPath];
[path setLineWidth:10.0f];
[path setLineCapStyle:kCGLineCapRound];
[path setLineJoinStyle:kCGLineJoinRound];
[path moveToPoint:CGPointMake(100, 100)];
[path addLineToPoint:CGPointMake(200, 100)];
[path addLineToPoint:CGPointMake(150, 100)];
[path moveToPoint:CGPointMake(100, 120)];
[path addLineToPoint:CGPointMake(200, 120)];
[path addLineToPoint:CGPointMake(150, 121)];
[[UIColor redColor] setStroke];
[path stroke];

显示的内容如下:

这是一个错误吗?
如果没有,有什么方法可以使顶部路径LineJoin取整? (不用弄乱点)

Is this a bug?If not, is there some way to get the top path LineJoin to be rounded? (without fudging the points)

当我从触摸输入创建UIBezierPath时出现了这种情况,而有时又会乱涂乱画。

This came up when I made a UIBezierPath from 'touch-input', and while scribbling around sometimes this happened.

推荐答案

此问题已在iOS 7中修复。
Open Radar也已更新。

This is fixed in iOS 7.Open Radar also updated.

这篇关于直线在180度路径中时出现意外的LineJoinStyle行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 02:10