Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. import UIKit
  2. import Contacts
  3.  
  4. class ContactListTableViewCell: UITableViewCell {
  5.  
  6. @IBOutlet weak var titleLabel: UILabel!
  7. @IBOutlet weak var phonenumberView: UIView!
  8.  
  9. func configureCell(contact: CNContact) {
  10. titleLabel.text = "(contact.givenName) (contact.familyName)"
  11.  
  12. for phoneNumber in contact.phoneNumbers {
  13.  
  14. let view = self.createContactListTableViewTelephoneRow(telephone: phoneNumber)
  15. self.phonenumberView.addSubview(view)
  16.  
  17.  
  18. }
  19.  
  20.  
  21. }
  22.  
  23. func createContactListTableViewTelephoneRow(telephone: Any) -> UIView {
  24. let controller = ContactListTableViewTelephoneRow()
  25. let view = UINib(nibName: "ContactListTableViewTelephoneRow", bundle: nil).instantiate(withOwner: controller, options: nil)[0] as! UIView
  26. return view
  27. }
  28.  
  29. }
  30.  
  31. class ContactListTableViewTelephoneRow: UIView {
  32.  
  33. @IBOutlet var view: UIView!
  34. @IBOutlet weak var telephoneLabel: UILabel!
  35. @IBOutlet weak var telephoneTypeLabel: UILabel!
  36.  
  37. func setData(telephoneLabelText: String, telephoneTypeLabelText: String) {
  38. telephoneLabel?.text = telephoneLabelText
  39. telephoneTypeLabel?.text = telephoneTypeLabelText
  40. }
  41.  
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement