专栏名称: Adrenine
iOS开发
目录
相关文章推荐
BioArt  ·  Cancer Cell丨靶向IL-15R信号 ... ·  8 小时前  
生物学霸  ·  张宏研究组招聘启事 ·  昨天  
生物探索  ·  Nature | ... ·  2 天前  
51好读  ›  专栏  ›  Adrenine

设置UIView特定几个角为圆角

Adrenine  · 掘金  ·  · 2017-12-13 08:46

正文

请到「今天看啥」查看全文


UIView *view = [[UIView alloc] initWithFrame:CGRectMake(120, 10, 80, 80)];
view.backgroundColor = [UIColor redColor];
[self.view addSubview:view]; 
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:view.bounds 
  byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight 
  cornerRadii:CGSizeMake(10, 10)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = view.bounds;
maskLayer.path = maskPath.CGPath;
view.layer.mask = maskLayer;

其中,







请到「今天看啥」查看全文