Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- import Contacts
- class ContactListTableViewCell: UITableViewCell {
- @IBOutlet weak var titleLabel: UILabel!
- @IBOutlet weak var phonenumberView: UIView!
- func configureCell(contact: CNContact) {
- titleLabel.text = "(contact.givenName) (contact.familyName)"
- for phoneNumber in contact.phoneNumbers {
- let view = self.createContactListTableViewTelephoneRow(telephone: phoneNumber)
- self.phonenumberView.addSubview(view)
- }
- }
- func createContactListTableViewTelephoneRow(telephone: Any) -> UIView {
- let controller = ContactListTableViewTelephoneRow()
- let view = UINib(nibName: "ContactListTableViewTelephoneRow", bundle: nil).instantiate(withOwner: controller, options: nil)[0] as! UIView
- return view
- }
- }
- class ContactListTableViewTelephoneRow: UIView {
- @IBOutlet var view: UIView!
- @IBOutlet weak var telephoneLabel: UILabel!
- @IBOutlet weak var telephoneTypeLabel: UILabel!
- func setData(telephoneLabelText: String, telephoneTypeLabelText: String) {
- telephoneLabel?.text = telephoneLabelText
- telephoneTypeLabel?.text = telephoneTypeLabelText
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement