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;
Just do this rather than use UIBezierPath
self.containerView.layer.cornerRadius = [Radius is half the height/width];
self.containerView.clipsToBounds = YES;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.