iOS学习引擎iOS DeveloperiOS 开发

iOS开发中为指定UIView的某几个角设置圆角

2016-08-17  本文已影响106人  iOSDevVicky

UIView*view2=[[UIView alloc]initWithFrame:CGRectMake(120,10,80,80)];view2.backgroundColor=[UIColor redColor];[self.view addSubview:view2];

//设置左下角和右下角为圆角

UIBezierPath *maskPath=[UIBezierPath bezierPathWithRoundedRect:view2.bounds byRoundingCorners:UIRectCornerBottomLeft|UIRectCornerBottomRight cornerRadii:CGSizeMake(10,10)];

CAShapeLayer* maskLayer=[[CAShapeLayer alloc]init];maskLayer.frame=view2.bounds;maskLayer.path=maskPath.CGPath;view2.layer.mask=maskLayer;

上一篇 下一篇

猜你喜欢

热点阅读