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

[Docs] Add workaround for setting a custom lineSpacing and maxNumberOfLines to ASTextNode docs #92

Merged
merged 3 commits into from
May 3, 2017

Conversation

maicki
Copy link
Contributor

@maicki maicki commented Apr 30, 2017

There are multiple reports about using lineSpacing and maximumNumberOfLines with ASTextNode will result in the wrong number of lines. As this issues comes up frequently let's add something to the docs for now.

Issues addressed:

Copy link
Member

@garrettmoon garrettmoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @maicki !

</pre>

<pre lang="swift" class = "swiftCode hidden">
TODO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this get to-done? Or should we just remove the swift bit for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added Swift example

</div>
</div>

`ASTextNode` uses Text Kit internally to calculate the amount to shrink that results in the max number of lines. Unfortunately in certain cases this will result that the text will shrink too much and in the example above instead of 4, 3 lines of text and a weird gap at the bottom will show up. To get around this issue for now, you have to set the `truncationMode` explicitly to `NSLineBreakByTruncatingTail` on the text node:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "internally to calculate the amount to shrink needed to result in the specified maximum number of lines."

Should be "Unfortunately, in certain cases this will result in the text shrinking too much in the above example; Instead of 4 lines of text, 3 lines of text and a weird gap at the bottom will show up"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

@garrettmoon
Copy link
Member

Should we create an umbrella issue for these, reference it in the docs and close the originals?

@maicki maicki force-pushed the MSTextNodeLineHeightDocs branch from 81835ef to 9eea2bf Compare May 2, 2017 22:28
@maicki maicki merged commit 6c20b19 into master May 3, 2017
@maicki
Copy link
Contributor Author

maicki commented May 3, 2017

@garrettmoon I consolidated all issues into: #227

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

Successfully merging this pull request may close these issues.

2 participants