UIButton * button = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 50, 50)];

    [self.view addSubview:button];

    

    CAShapeLayer * shapeLayer = [CAShapeLayer layer];

    shapeLayer.frame = self.textButton.bounds;

    UIBezierPath * drawPath = [UIBezierPath bezierPathWithRoundedRect:self.textButton.bounds byRoundingCorners:(UIRectCornerBottomRight|UIRectCornerBottomLeft|UIRectCornerTopRight) cornerRadii:CGSizeMake(25.0, 25.0)];

    shapeLayer.path = drawPath.CGPath;

    //shapeLayer.masksToBounds = YES;

    button.layer.mask = shapeLayer;

posted on 2016-07-18 11:53  拿起放不下  阅读(308)  评论(0编辑  收藏  举报