简体   繁体   中英

multiline CATextLayer with NSAttributedString strange spacing

Using text that I have gotten from a UITextView I render the text on top of the video. I am using a CATextLayer and getting a really strange result. When I use a UILabel to display it on the screen for a preview it looks fine and doesn't have the spacing problem.

Is there any way to format the CATextLayer so that it matches the UILabel result? So far from what I tried is that formatting the NSAttributedString before putting it on the CATextLayer does nothing.

Any advice?

Well instead of trying to get the formatting correct I fed the text through a UILabel and used the label's CALayer and it came out looking exactly the way I wanted. Not exactly the cleanest solution but it worked!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM