J'utilise une chaîne attribuée au texte barré dans un WKInterfaceLabel
. Cela fonctionne jusqu'au point où le texte est plus long que la largeur de la montre et donc vous voyez ...
En fait, la même chose se produit sur iOS; Cependant, vous pouvez découper du contenu qui résout le problème. Sur la montre, l'écrêtage n'est pas disponible.La chaîne WKInterfaceLabel affectée échoue sur la largeur
Comment puis-je barrer le texte visible lorsque la largeur hors tout dépasse les limites de l'écran? Ci-dessous le code:
let attributedString = NSMutableAttributedString(string: self.fileTextArray[i])
attributedString.addAttribute(NSStrikethroughStyleAttributeName, value: NSNumber(value: NSUnderlineStyle.styleThick.rawValue), range: NSMakeRange(0, attributedString.length))
attributedString.addAttribute(NSStrikethroughColorAttributeName, value: UIColor.red, range: NSMakeRange(0, attributedString.length))
row.translatedTextLabel.setAttributedText(attributedString)