UIView部分圆角与旋转

来源:互联网 发布:本西蒙斯捏脸数据 编辑:程序博客网 时间:2024/04/28 05:45

- (void)partOfTheFilletAndRotation

{

    UIView *myView = [[UIViewalloc] initWithFrame:CGRectMake(0,0, 300,200)];

    myView.backgroundColor = [UIColorredColor];

    

#pragma mark 部分圆角

    

    UIBezierPath *maskPath=[UIBezierPath bezierPathWithRoundedRect:myView.boundsbyRoundingCorners:(UIRectCornerTopLeft |UIRectCornerBottomLeft) cornerRadii:CGSizeMake(5.0,5.0)];

    CAShapeLayer *maskLayer=[[CAShapeLayeralloc] init];

    maskLayer.frame=myView.bounds;

    maskLayer.path=maskPath.CGPath;

    myView.layer.mask=maskLayer;

    

    /**

     *  指定需要圆角的角,可选值有5个,中间用“|”分割

     *

     *  UIRectCornerTopLeft

     *  UIRectCornerTopRight

     *  UIRectCornerBottomLeft

     *  UIRectCornerBottomRight

     *  UIRectCornerAllCorners

     *

     */

    

#pragma mark view旋转

    

    CGAffineTransform at =CGAffineTransformMakeRotation(M_PI/1);

    at = CGAffineTransformTranslate(at,0, 0);

    [myView setTransform:at];

    

}

0 0