Guest User

Untitled

a guest
Feb 25th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. import UIKit
  2.  
  3. class ViewController: UIViewController {
  4.  
  5. @IBOutlet weak var textView: UITextView!
  6.  
  7. override func viewDidLoad() {
  8. super.viewDidLoad()
  9. // Do any additional setup after loading the view, typically from a nib.
  10.  
  11. attributed()
  12. }
  13.  
  14. override func didReceiveMemoryWarning() {
  15. super.didReceiveMemoryWarning()
  16. // Dispose of any resources that can be recreated.
  17. }
  18.  
  19. func attributed() {
  20. let style = NSMutableParagraphStyle()
  21. style.lineSpacing = 6
  22. let textAttributes: [NSAttributedStringKey : Any] = [
  23. .font : UIFont.systemFont(ofSize: 24.0),
  24. .paragraphStyle : style,
  25. .foregroundColor : UIColor.green,
  26. .strokeColor : UIColor.red,
  27. .strokeWidth : -3.0
  28. ]
  29. let text = NSAttributedString(string: "Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.", attributes: textAttributes)
  30. textView.attributedText = text
  31. }
  32. }
Add Comment
Please, Sign In to add comment