我正在使用以下代码,并且在聊天气泡的左上角有一条额外的笔触线。请检查此图像以供参考:
UIRectCorner corners;
if (type == BubbleTypeSomeoneElse)
{
self.bubbleImage.image = nil;
corners = UIRectCornerBottomRight|UIRectCornerTopRight|UIRectCornerTopLeft;
}
else {
self.bubbleImage.image = nil;
corners = UIRectCornerBottomLeft|UIRectCornerTopRight|UIRectCornerTopLeft;
}
// space between each bubble
self.bubbleImage.frame = CGRectMake(x, y, width + self.data.insets.left + self.data.insets.right, height + self.data.insets.top-10 + self.data.insets.bottom);
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.bubbleImage.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(7, 7)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = self.bubbleImage.bounds;
maskLayer.path = path.CGPath;
CAShapeLayer *borderLayer = [[CAShapeLayer alloc] init];
borderLayer.frame = self.bubbleImage.bounds;
borderLayer.path = path.CGPath;
borderLayer.lineWidth = 1.0f;
borderLayer.strokeColor = [UIColor blackColor].CGColor;
borderLayer.fillColor = [UIColor clearColor].CGColor;
[self.bubbleImage.layer addSublayer:borderLayer];
请让我知道我在上面的代码中做错了什么,如果在我的代码注释中需要更多信息,我将尽快提供。
提前谢谢!