2018-09-07

oc 圆角阴影设置 

View.backgroundColor = [UIColor whiteColor]; 

View.layer.shadowColor = HEXCOLOR(0x959595).CGColor;//阴影颜色    View.layer.shadowOffset = CGSizeMake(0, 0);//偏移距离    View.layer.shadowOpacity=0.15;//不透明度    

View.layer.shadowRadius=10.0;//半径

View.layer.cornerRadius=10; 圆角

上边圆角 包括左边和右边

 View.backgroundColor = [UIColor whiteColor];    View.layer.shadowColor = HEXCOLOR(0x959595).CGColor;//阴影颜色

    View.layer.shadowOffset = CGSizeMake(0, 0);//偏移距离

    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:View.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(8, 8)];

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

    maskLayer.frame= View.bounds;

    maskLayer.path= maskPath.CGPath;

    View.layer.mask= maskLayer;

下边圆角 包括左边和右边

  View.backgroundColor = [UIColor whiteColor];

    View.layer.shadowColor = HEXCOLOR(0x959595).CGColor;//阴影颜色

    View.layer.shadowOffset = CGSizeMake(0, 0);//偏移距离

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

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

    maskLayer.frame= View.bounds;

    maskLayer.path= maskPath.CGPath;

    View.layer.mask= maskLayer;

你可能感兴趣的:(2018-09-07)