Use the layer's corner radius rather than a custom mask.

This will ensure the mask bounds always match the view's size.
This commit is contained in:
Doug
2021-07-14 10:37:54 +01:00
parent c7176c7423
commit d181065321
+2 -15
View File
@@ -1041,21 +1041,8 @@ const CGFloat kTypingCellHeight = 24;
{
if (cell.attachmentView)
{
UIBezierPath *myClippingPath = [UIBezierPath bezierPathWithRoundedRect:cell.attachmentView.bounds cornerRadius:6];
CAShapeLayer *mask;
// check for an existing mask in case the cell is being reused, otherwise create a new one
if ([cell.attachmentView.layer.mask isKindOfClass:[CAShapeLayer class]])
{
mask = (CAShapeLayer*)cell.attachmentView.layer.mask;
}
else
{
mask = [CAShapeLayer layer];
}
mask.path = myClippingPath.CGPath;
cell.attachmentView.layer.mask = mask;
cell.attachmentView.layer.cornerRadius = 6;
cell.attachmentView.layer.masksToBounds = YES;
}
}