如何画制半圆

来源:互联网 发布:手机立体声软件 编辑:程序博客网 时间:2024/05/17 01:45

在项目中有时候会需要画制各种图形,比如需要绘制一个半圆。在网上找了些资料,感觉太过复杂,实现起来并没有想像中的那么简单好用,自己想了一个简单的实现方法,可以快速的绘制一个半圆的图形。


- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIView *angle=[[UIView alloc]initWithFrame:CGRectMake(100, 100, 60, 30)];
    angle.backgroundColor=[UIColor clearColor];
    angle.clipsToBounds=YES;
//    angle.layer.cornerRadius=30;
    [self.view addSubview:angle];
    
    
    UIView *angle1=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 60, 60)];
    angle1.backgroundColor=[UIColor blueColor];
    angle1.layer.cornerRadius=30;
    [angle addSubview:angle1];
}

0 0
原创粉丝点击