MessageInfoViewController.swift 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import UIKit
  2. class MessageInfoViewController: UITableViewController {
  3. var message: DCMessage
  4. init(message: DCMessage) {
  5. self.message = message
  6. super.init(style: .grouped)
  7. }
  8. required init?(coder _: NSCoder) {
  9. fatalError("init(coder:) has not been implemented")
  10. }
  11. override func viewDidLoad() {
  12. super.viewDidLoad()
  13. title = String.localized("menu_message_details")
  14. }
  15. // MARK: - Table view data source
  16. override func numberOfSections(in _: UITableView) -> Int {
  17. return 1
  18. }
  19. override func tableView(_: UITableView, numberOfRowsInSection section: Int) -> Int {
  20. return 1 // number of rows in section
  21. }
  22. override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  23. let cell: UITableViewCell
  24. if let c = tableView.dequeueReusableCell(withIdentifier: "MessageInfoCell") {
  25. cell = c
  26. } else {
  27. cell = UITableViewCell(style: .default, reuseIdentifier: "MessageInfoCell")
  28. }
  29. if indexPath.section == 0 {
  30. if indexPath.row == 0 {
  31. cell.textLabel?.text = message.text
  32. }
  33. }
  34. return cell
  35. }
  36. }