Skip to content

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

Merged
maicki merged 3 commits into
masterfrom
MSTextNodeLineHeightDocs
May 3, 2017
Merged

[Docs] Add workaround for setting a custom lineSpacing and maxNumberOfLines to ASTextNode docs#92
maicki merged 3 commits into
masterfrom
MSTextNodeLineHeightDocs

Conversation

@maicki

@maicki maicki commented Apr 30, 2017

Copy link
Copy Markdown
Contributor

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:

@maicki
maicki force-pushed the MSTextNodeLineHeightDocs branch from 417332c to 81835ef Compare April 30, 2017 21:17

@garrettmoon garrettmoon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @maicki !

Comment thread docs/_docs/text-node.md Outdated
</pre>

<pre lang="swift" class = "swiftCode hidden">
TODO

Copy link
Copy Markdown
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
Copy Markdown
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

Comment thread docs/_docs/text-node.md Outdated
</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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

maicki commented May 3, 2017

Copy link
Copy Markdown
Contributor Author

@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