简体   繁体   中英

How to handle word wrap in iOS' UILabel/UITextView for the Chinese language for multiple screen sizes?

I've an app that is being localized to Simplified Chinese . I've noticed that sometimes UILabels and UITextViews wrap characters but not entire words.

It seems a bit crazy to go through the Chinese language to manually point out line breaks for every single localized string for every single device size and orientation.

Is there a way to use NSLinguisticTagger to extract the words and tell UILabel to wrap based on what was tagged?

TextView.lineBreakMode = NSLineBreakMode.ByWordWrapping

TextView.sizeToFit()

Same for labels. It works for me not in Chinese but you can try

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