Dipen STL
Dipen STL

Reputation: 41

How can i set lineBreakMode to wordwrap in WKInterfaceLabel?

Can anyone help me to set a lineBreakMode to wordWrap in WKInterfaceLabel in my watch app?

I tried with setAttributedText but didn't get any success. Here is my code for the same. I am using swift as programming language.

    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);

Upvotes: 0

Views: 128

Answers (0)

Related Questions