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

Button with corner-radius clips button text #266

Open
glentregoning opened this issue Aug 7, 2014 · 2 comments
Open

Button with corner-radius clips button text #266

glentregoning opened this issue Aug 7, 2014 · 2 comments

Comments

@glentregoning
Copy link
Contributor

When we style a button with a corner radius the text within it gets clipped on iOS7.1.

This isn't reproducible on iOS8.

E.g.
my-custom-button {
corner-radius: 14px;
border-width: 1px;
border-color: white;
}

screen shot 2014-08-07 at 12 27 23 pm

The root cause of this appears to be due to the NUIButtonRenderer applying corner radius values to all of it's sub-layers including the UIButton's internal UILabel.

@glentregoning
Copy link
Contributor Author

Looking through the change history it appears as if this sub-layer application of corner-radius (and removal of layer.masksToBounds = YES) was introduced to allow shadow handling.

phatmann added a commit that referenced this issue Oct 8, 2014
squarefrog added a commit to squarefrog/nui that referenced this issue Apr 18, 2015
* 'master' of https://github.com/tombenner/nui:
  Update to 0.5.5
  Fixing  objc_msgSend([UIColor class], selector); cause error: too many arguments to function call, expected 0, have 2, after upgrading to Cocoapods 0.36
  Use iOS 7.1 simulator
  Only adjusting the corner radius of UIButton nested view's / layers (except UILabel) if a shadow-* property is set. This avoids and issue with clipping button text when using corner-radius (see tombenner#266)
  Add tests to cover setting background images from a subdirectory within the app bundle
  Add forward slash to list of characters allowed in a style value
  NUISegmentedControlRenderer: added support for custom sizes in segmented controls.
  NUIGraphics: removed hard-coded size from methods to create 'rounded rect layers'; a parameter is used instead.
@mateagar
Copy link

mateagar commented Mar 7, 2017

There is an issue with this change: masksToBounds is set to NO for the button's layer. This effectively wipes out the corner radius setting. I think this should only be set on the layer of the subview which corresponds to the label only.

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