You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.3 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. //
  2. // GmeContactsTableViewCell.swift
  3. // GMERemittance
  4. //
  5. // Created by gme_2 on 25/08/2018.
  6. // Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import UIKit
  9. class GmeContactsTableViewCell: UITableViewCell {
  10. @IBOutlet weak var titleLabel: UILabel!
  11. @IBOutlet weak var addressLabel: UILabel!
  12. @IBOutlet weak var languageLabel: UILabel!
  13. @IBOutlet weak var bgView: UIView!
  14. @IBOutlet weak var telephoneButton: UIButton!
  15. var contact: GmeContacts?
  16. func setup() {
  17. self.bgView.layer.cornerRadius = 8
  18. self.titleLabel.text = contact?.title
  19. self.addressLabel.text = contact?.address
  20. self.languageLabel.text = contact?.language
  21. self.telephoneButton.setTitle(contact?.contactNumber ?? "", for: UIControlState.normal)
  22. self.languageLabel.isHidden = (contact?.language ?? "") == ""
  23. }
  24. @IBAction func showMap(_ sender: UIButton) {
  25. print("show on map")
  26. }
  27. @IBAction func call(_ sender: UIButton) {
  28. if var number = self.contact?.contactNumber {
  29. number = number.removeWhitespacesInBetween()
  30. if let url = URL(string: "tel://\(number)") {
  31. if UIApplication.shared.canOpenURL(url) {
  32. UIApplication.shared.openURL(url)
  33. }
  34. }
  35. }
  36. }
  37. }