记录 贝塞尔曲线创建圆角

2017-08-30  本文已影响21人  咋了爸爸
  UIView *greenView = [[UIView alloc] initWithFrame:CGRectMake(10, 200, 100, 100)];
    greenView.backgroundColor = [UIColor greenColor];
    [self.view addSubview:greenView];
    //添加圆角
    UIBezierPath *cornerPath1 = [UIBezierPath bezierPathWithRoundedRect:greenView.bounds byRoundingCorners:(UIRectCornerTopRight|UIRectCornerBottomLeft|UIRectCornerTopLeft|UIRectCornerBottomRight) cornerRadii:CGSizeMake(5, 5)];
    CAShapeLayer *maskLayer1 = [CAShapeLayer layer];
    maskLayer1.frame = greenView.bounds;
    maskLayer1.path = cornerPath1.CGPath;
    greenView.layer.mask = maskLayer1;
上一篇下一篇

猜你喜欢

热点阅读