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;