美文网首页
利用贝塞尔曲线添加虚线

利用贝塞尔曲线添加虚线

作者: ymhlbj | 来源:发表于2018-12-06 09:01 被阅读9次
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0 , 110, 110)];
[self.view addSubview:view];
CAShapeLayer *layer   = [[CAShapeLayer alloc] init];
layer.frame = CGRectMake(0, 0 , 110, 110);
NSLog(@"%f,%f",layer.frame.size.width,layer.frame.size.height);
layer.backgroundColor = [UIColor clearColor].CGColor;
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:layer.frame cornerRadius:4.0f];
layer.path = path.CGPath;
layer.lineWidth = 1.0f;
layer.lineDashPattern = @[@4, @4];
layer.fillColor = [UIColor clearColor].CGColor;
layer.strokeColor = [UIColor grayColor].CGColor;
[view.layer addSublayer:layer];

相关文章

网友评论

      本文标题:利用贝塞尔曲线添加虚线

      本文链接:https://www.haomeiwen.com/subject/nflncqtx.html