Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. @IBAction func addToken(sender: AnyObject) {
  2. let title = names[Int(arc4random_uniform(UInt32(names.count)))] as String
  3. let token = KSToken(title: title, object: title as AnyObject?)
  4.  
  5. // Token background color
  6. var red = CGFloat(Float(arc4random()) / Float(UINT32_MAX))
  7. var green = CGFloat(Float(arc4random()) / Float(UINT32_MAX))
  8. var blue = CGFloat(Float(arc4random()) / Float(UINT32_MAX))
  9. token.tokenBackgroundColor = UIColor(red: red, green: green, blue: blue, alpha: 1.0)
  10.  
  11. // Token text color
  12. red = CGFloat(Float(arc4random()) / Float(UINT32_MAX))
  13. green = CGFloat(Float(arc4random()) / Float(UINT32_MAX))
  14. blue = CGFloat(Float(arc4random()) / Float(UINT32_MAX))
  15. token.tokenTextColor = UIColor(red: red, green: green, blue: blue, alpha: 1.0)
  16.  
  17. tokenView.addToken(token)
  18. }
  19.  
  20. /// An array of string values. Default values are "." and ",". Token is created with typed text, when user press any of the character mentioned in this Array
  21. open var tokenizingCharacters = [".", ","]
  22.  
  23. tokenView.tokenizingCharacters = [];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement