2016-11-28 4 views
0

ウェザーを知るにはUITextViewはスペースが足りないためテキストを短くしますか? boundingRectWithSizesizeThatFitで計算できますが、UITextViewexclusionPathsが変更された場合はどうなりますか?ポリゴンに文字列をレイアウトし、ポリゴンのサイズを増やして文字列を短くすることなくレイアウトします。どのようなアイデアは、どのようにboolリターンを得ることができる、現在の設定がより短くなりますか?UITextViewはテキストを短くしますか?

self.tv.textContainer.exclusionPaths = myArrayOfBezierPaths; 
+0

[あなたは?これを読みました](http://stackoverflow.com/a/19917287/312312) – Lefteris

答えて

2
func isSizeFitForTextView() -> Bool{ 
    let layoutManager = self.textView.layoutManager 
    let glyphIndex = layoutManager.glyphIndexForCharacter(at:(self.textView.text as NSString).length) 

    let range = layoutManager.truncatedGlyphRange(inLineFragmentForGlyphAt: glyphIndex) 

    return range.location != NSNotFound 
} 
関連する問題