gpt4 book ai didi

objective-c - NSParagraphStyle hypenationFactor 不起作用

转载 作者:行者123 更新时间:2023-11-29 11:11:09 25 4
gpt4 key购买 nike

我正在尝试完全证明并允许在 NSAttributedString 中使用连字符。现在我使用代码设置段落样式:

NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];
paragraph.alignment = NSTextAlignmentJustified;
paragraph.hyphenationFactor = 0.5;
paragraph.lineBreakMode = NSLineBreakByWordWrapping;

这不会连字符,它只是根据适合的程度拆分单词。我也试过 NSLineBreakByCharWrapping ,结果更糟。有任何想法吗?我正在使用 iOS 6 库。

谢谢,皮特

最佳答案

最近发现:

库中有一个错误,任何介于 0.0 和 1.0 之间的值都不起作用。也就是说,值 0.0 和 1.0 确实有效。因此,要获得断字,从 iOS6 开始将断字因子设置为 1.0。

关于objective-c - NSParagraphStyle hypenationFactor 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11549210/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com