Last active
August 29, 2015 14:22
-
-
Save smallmake/db7b6d0f47258971fa4a to your computer and use it in GitHub Desktop.
drawWithRectでTail Truncationする(ParagraphではなくRectで)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let style = NSMutableParagraphStyle() | |
style.lineBreakMode =.ByWordWrapping | |
style.alignment = NSTextAlignment.Left | |
let stringAttrubute = [ | |
NSParagraphStyleAttributeName: style | |
] | |
let sampleText = "このStringは、このように...(略)...するようにしたい。途中で改行がはいるのである。\nどうすればいいのだろう?あ、できた!\nそして、まだまだStringは続く....(略)...." | |
sampleText.drawWithRect( | |
CGRectMake(0,0,800,300), | |
options: .UsesLineFragmentOrigin | .TruncatesLastVisibleLine, | |
attributes: stringAttrubute as [NSObject : AnyObject], | |
context: nil) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
下記を参照してください。
http://qiita.com/smallmake/items/01838ea052e578225db2