3

In my app, I'm currently drawing a basic view, and then I'm trying to round it's corners using a CAShapeLayer, but the UICollisionBehavior still reacts like it's a square that is drawn.

Here's an example of my code

  UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.bounds
                                           byRoundingCorners:UIRectCornerAllCorners
                                                 cornerRadii:radiiSize];

// Mask the container view’s layer to round the corners.
CAShapeLayer *cornerMaskLayer = [CAShapeLayer layer];
[cornerMaskLayer setPath:path.CGPath];
self.containerView.layer.mask = cornerMaskLayer;
self.containerView.layer.allowsEdgeAntialiasing = YES;
Justin Cabral
  • 565
  • 1
  • 6
  • 20

1 Answers1

-3

Just do this rather than use UIBezierPath

self.containerView.layer.cornerRadius = [Radius is half the height/width];
self.containerView.clipsToBounds = YES;
Ethan Fang
  • 1,271
  • 10
  • 15