Guest User

Untitled

a guest
Dec 13th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. let a_attrib: [NSAttributedString.Key : Any] = [NSAttributedString.Key.foregroundColor: UIColor.purple, NSAttributedString.Key.writingDirection: NSWritingDirection.rightToLeft];
  2.  
  3. let a_attrib: [NSAttributedString.Key : Any] = [NSAttributedString.Key.foregroundColor: UIColor.purple];
  4. self.myTextArea.makeTextWritingDirectionRightToLeft(self);
  5.  
  6. func getMeaning() {
  7. do {
  8. let combination = NSMutableAttributedString();
  9. let q = try db.prepare("select word, meaning from Mani where SID=(self.SID) and IsFarsi=true");
  10. for x in q {
  11. let a_attrib: [NSAttributedString.Key : Any] = [NSAttributedString.Key.foregroundColor: UIColor.purple];
  12. let b_attrib: [NSAttributedString.Key : Any] = [NSAttributedString.Key.foregroundColor: UIColor.black];
  13. let a = (x[0]! as? String)! + "n";
  14. let b = (x[1]! as? String)! + "nn";
  15.  
  16. let aa = NSAttributedString(string: a, attributes: a_attrib);
  17. let bb = NSAttributedString(string: b, attributes: b_attrib);
  18. combination.append(aa);
  19. combination.append(bb);
  20. }
  21. self.myTextArea.attributedText = combination;
  22. } catch {
  23. print(error);
  24. }
  25. }
Add Comment
Please, Sign In to add comment