Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE REQUEST : Button Radius #32

Open
Adrian-Sweeney opened this issue Oct 3, 2017 · 1 comment
Open

FEATURE REQUEST : Button Radius #32

Adrian-Sweeney opened this issue Oct 3, 2017 · 1 comment

Comments

@Adrian-Sweeney
Copy link

Adrian-Sweeney commented Oct 3, 2017

I would like to put two buttons side by side and have the left side of button one be curved and the right side of button two be curved

Also if I could have the ability to specify if the radius us specified on specific corners

Button.RadiusTopLeft =
Button.RadiusTopRight =
Button.RadiusBottomLeft =
Button.RadiusBottomRight =

Also would it be possible to specify that the button is transparent with a border

Button.BorderWidth =
Button.BorderColor =

We are having to use a couple of images in a view and would like to replace them with your button

@bfeher
Copy link
Owner

bfeher commented Oct 4, 2017

Hi @Adrian-Sweeney

Unfortunately this control doesn't support arbitrary Bezier paths. The reason being that for the layer to 'clip' to a path, we have to mask it. If we mask it, we lose the underlying shadow :/
If we use .layer.cornerRadius (which this control currently does) then we don't have to mask anything, but we affect all 4 corners.

However, if I can find some time I will try and work around this for the next release.

As for the border color and border width, you can add these yourself very easily until the feature makes it into the release version by adding some code to BFPaperButton.h/m:

Add to BFPaperButton.h:

@property (nonatomic) IBInspectable UIColor *borderColor;
@property (nonatomic) IBInspectable CGFloat borderWidth;

Add to BFPaperButton.m:

// In -(void)layoutSubviews, towards the bottom of this function, right before [self setEnabled:self.enabled];
self.layer.borderColor = self.borderColor.CGColor;
self.backgroundColorFadeLayer.borderColor = self.borderColor.CGColor;
self.layer.borderWidth = self.borderWidth;
self.backgroundColorFadeLayer.borderWidth = self.borderWidth;

// Right after #pragma mark - Setters, add these 2 functions:
- (void)setBorderColor:(UIColor *)borderColor {
    _borderColor = borderColor;
    self.layer.borderColor = borderColor.CGColor;
    self.backgroundColorFadeLayer.borderColor = borderColor.CGColor;
}

- (void)setBorderWidth:(CGFloat)borderWidth {
    _borderWidth = borderWidth;
    self.layer.borderWidth = borderWidth;
    self.backgroundColorFadeLayer.borderWidth = borderWidth;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants