iOS 指定圓角個(gè)數(shù)
需要實(shí)現(xiàn)的效果很明確,只要左上和右上兩個(gè)地方圓角,以前都是通過layer 直接設(shè)置四個(gè)角都變成圓角,然后我就開始了強(qiáng)大的搜索功能
然后我就獲得了我想要的東西
技術(shù)鏈接:http://www.xuebuyuan.com/1710271.html
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(72, 91, 115, 66)];
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:imgView.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(8, 8)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = imgView.bounds;
maskLayer.path = maskPath.CGPath;
imgView.layer.mask = maskLayer;
上面是我的代碼 具體可以根據(jù)捏需求來設(shè)置圓角,原文寫的很清楚咯 我就不多少了
浙公網(wǎng)安備 33010602011771號