iOS view的上左 上右 下左 下右 的单独圆角问题

阅读 68

2021-09-22

    UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    view.backgroundColor=[UIColor greenColor];
    [self.view addSubview:view];
    CAShapeLayer *maskLayer = [CAShapeLayer layer];
    maskLayer.path = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners: UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii: (CGSize){5.0f, 5.0f}].CGPath
    view.layer.masksToBounds = YES;
    view.layer.mask = maskLayer;

精彩评论(0)

0 0 举报