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

resizing a UILabel #117

Closed
corysullivan opened this issue Jan 25, 2018 · 3 comments
Closed

resizing a UILabel #117

corysullivan opened this issue Jan 25, 2018 · 3 comments
Labels

Comments

@corysullivan
Copy link

I'm a little confused on how to handle the layout of a UILabel that may contain 1 or 2 lines. I would like to preserve the origin and width, however just extend the height. Basically, I want to use sizeToFit(), but only apply it to the height

group

@lucdion
Copy link
Member

lucdion commented Jan 25, 2018

Hi @Sully73,
You simply need to do something like:

myLabel.pin.sizeToFit(.width) 

In the documentation related to sizeToFit(.width): "If properties related to the width have been pinned (e.g: width, left & right, margins, ...), the reference width will be determined by these properties, if not the current view's width will be used."
See here for more details about sizeToFit: https://github.com/mirego/PinLayout#sizetofit

@corysullivan
Copy link
Author

ah, I see thank you. I didn't fully understand the sizeToFit method.

@lucdion
Copy link
Member

lucdion commented Jan 25, 2018

In that case it will adjust the height to fit the current width.

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

No branches or pull requests

2 participants