谁能帮我在手表应用程序的 WKInterfaceLabel 中将 lineBreakMode 设置为 wordWrap 吗?
我尝试使用 setAttributedText 但没有成功。这是我的代码。我使用 swift 作为编程语言。
let font = UIFont.systemFont(ofSize: 15);
let style = NSMutableParagraphStyle();
style.lineBreakMode = .byWordWrapping;
let attributes: [NSAttributedString.Key: Any] = [
.font: font,
.paragraphStyle: style,
];
let attributedString = NSAttributedString(string: getPromptText(), attributes: attributes)
lblDisplayText.setAttributedText(attributedString);