2017-06-30 10 views
0

WKInterfaceLabelの文字列にアトリビュート文字列を使用しています。これは、テキストが時計の幅よりも長く、したがってあなたが...と表示されるまで、これは動作します。実際には、iOSでも同じことが起こります。ただし、問題を解決するコンテンツをクリップすることができます。時計では、クリッピングは利用できません。WKInterfaceLabelアトリビュートされた文字列の幅が正しくない

全体の幅が画面の境界を超えている場合に、表示可能なテキストを取り除くにはどうすればよいですか?以下はコードです:

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) 

答えて

関連する問題