您的位置:首页 > 产品设计 > UI/UE

UIView设置指定角为圆角的代码

2016-06-23 09:48 351 查看
提供一个UIView设置指定角为圆角的代码,可以在按钮上试试,如果不行的话可以考虑将按钮换成UIView,给UIView加个单击手势,希望对你有帮助!

UIView *whiteView = [[UIView alloc] initWithFrame:CGRectMake(30, CGRectGetMaxY(pickerView.frame), With-60, 50)];

    whiteView.backgroundColor = [UIColor whiteColor];

    UIBezierPath *maskPath1 = [UIBezierPath bezierPathWithRoundedRect:whiteView.bounds byRoundingCorners:UIRectCornerBottomLeft
| UIRectCornerBottomRight cornerRadii:CGSizeMake(5, 5)];

    CAShapeLayer *maskLayer1 = [[CAShapeLayer alloc] init];

    maskLayer1.frame = whiteView.bounds;

    maskLayer1.path = maskPath1.CGPath;

    whiteView.layer.mask = maskLayer1; 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: