Ios 如何只用笔划画圆

Ios 如何只用笔划画圆,ios,quartz-graphics,geometry,Ios,Quartz Graphics,Geometry,我只想用笔划画一个圆,下面的代码画得很好,但它填充了这个圆 我不想让它填满。请帮帮我 self.circleView = [[UIView alloc] initWithFrame:CGRectMake(10,20,20,20)]; circleView.alpha = 0.5; self.circleView.layer.cornerRadius = 50; self.circleView.backgroundColor = [UIColor whiteColo

我只想用笔划画一个圆,下面的代码画得很好,但它填充了这个圆

我不想让它填满。请帮帮我

    self.circleView = [[UIView alloc] initWithFrame:CGRectMake(10,20,20,20)];
    circleView.alpha = 0.5;
    self.circleView.layer.cornerRadius = 50;
    self.circleView.backgroundColor = [UIColor whiteColor];
改变

self.circleView.backgroundColor = [UIColor whiteColor];

对于边框(笔划),添加


现在它是空的,屏幕上没有显示任何内容哦,您还必须设置边框宽度:
self.circleView.layer.borderWidth=2
那么这就是问题所在,我只想在圆圈内部填充一个数字;我的代码是UILabel*circleLabel=[[UILabel alloc]init];[circleLabel setText:@“1”];[circleView Add子视图:circleLabel];但它不起作用,因为您的circleLabel有一个帧(0,0,0,0)。您需要使用
[[UILabel alloc]initWithFrame:]代替了
[[UILabel alloc]init]
self.circleView.backgroundColor = [UIColor clearColor];
self.circleView.layer.borderColor = [[UIColor redColor] CGColor];
self.circleView.layer.borderWidth = 1;