Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? {
  2. let attributedString = NSAttributedString(string: pickerData[row], attributes: [NSForegroundColorAttributeName : UIColor.white,NSFontAttributeName: UIFont.fontWithStyle(.customRegular, fixedSize: 10.0)])
  3. return attributedString
  4. }
  5.  
  6. func pickerView(pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusingView view: UIView?) -> UIView {
  7.  
  8. var label = view as! UILabel!
  9. if label == nil {
  10. label = UILabel()
  11. }
  12.  
  13. var data = pickerData[row]
  14. let title = NSAttributedString(string: data, attributes: [NSFontAttributeName: UIFont.fontWithStyle(.customRegular, fixedSize: 10.0)])
  15. label?.attributedText = title
  16. label?.textAlignment = .right
  17. return label!
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement