自由設置矩形的四個角爲圓角

    UIView *progress = [[UIView alloc] init];spa

    progress.backgroundColor = [UIColor redColor];it

    progress.frame = CGRectMake(20, 20, 300, 50);class

    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:progress.bounds byRoundingCorners:UIRectCornerBottomLeft|UIRectCornerTopLeft cornerRadii:CGSizeMake(25, 25)];margin

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

    maskLayer.frame = progress.bounds;view

    maskLayer.path = maskPath.CGPath;vi

    progress.layer.mask = maskLayer;co

    [self.view addSubview:progress];background

相關文章
相關標籤/搜索