設定UIView幾個角為圓角
阿新 • • 發佈:2019-01-05
UIButton *btn = [[UIButtonalloc] initWithFrame:CGRectMake(PhaseHalf(CGRectGetWidth(self.view.bounds),kWidth), PhaseHalf(CGRectGetHeight(self.view.bounds),kWidth), kWidth, kWidth)];
[btn setBackgroundColor:[UIColorredColor]];
[self.view addSubview:btn];
[btn addTarget:selfaction:@selector
UIBezierPath *maskPath = [UIBezierPathbezierPathWithRoundedRect:btn.boundsbyRoundingCorners:UIRectCornerBottomLeft| UIRectCornerBottomRightcornerRadii:CGSizeMake(10.0, 10.0)];
CAShapeLayer *maskLayer = [CAShapeLayerlayer];
maskLayer.frame
maskLayer.path = maskPath.CGPath;
btn.layer.mask = maskLayer;