优惠券swift版马甲包

YMMyViewController.swift 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. //
  2. // YMMyViewController.swift
  3. // MvpGoods
  4. //
  5. // Created by 小花 on 2019/4/19.
  6. // Copyright © 2019 MVP. All rights reserved.
  7. //
  8. import UIKit
  9. class YMMyViewController: YMBaseViewController {
  10. var tableView: UITableView?
  11. override func viewDidLoad() {
  12. super.viewDidLoad()
  13. self.title = "我的"
  14. self.view.backgroundColor = UIColor.white
  15. self.automaticallyAdjustsScrollViewInsets = false
  16. configTableView()
  17. configNavBar()
  18. }
  19. func configNavBar() {
  20. self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
  21. self.navigationController?.navigationBar.shadowImage = UIImage()
  22. }
  23. func configTableView() {
  24. let tableView = UITableView(frame: CGRect(x: 0, y: 0, width: SCREENW, height: SCREENH-navHeight-tabBarHeight), style: .plain)
  25. tableView.estimatedSectionHeaderHeight = 0;
  26. tableView.estimatedSectionFooterHeight = 0;
  27. tableView.sectionFooterHeight = 0;
  28. tableView.sectionHeaderHeight = 0;
  29. tableView.estimatedRowHeight = 100;
  30. tableView.delegate = self;
  31. tableView.dataSource = self;
  32. tableView.tableFooterView = UIView(frame: CGRect.zero)
  33. tableView.tableHeaderView = UIView(frame: CGRect.zero)
  34. tableView.backgroundColor = UIColor.white;
  35. tableView.showsVerticalScrollIndicator = false;
  36. tableView.separatorColor = UIColor.hexadecimalColor(hexadecimal: "0xe5e5e5");
  37. tableView.separatorStyle = .singleLine
  38. self.tableView = tableView
  39. self.view.addSubview(tableView)
  40. }
  41. lazy var dataArr: [[String: String]] = {
  42. let data = [["name":"设置","image":"setting"],
  43. ["name":"新手指南","image":"zhinan"],
  44. ["name":"去评分","image":"pingfen"],
  45. ["name":"意见反馈","image":"guide"]]
  46. return data
  47. }()
  48. func gotoSettingPage() {
  49. let set = YMSettingViewController()
  50. self.navigationController?.pushViewController(set, animated: true)
  51. }
  52. func gotoNewGuide() {
  53. let priva = YMPrivateViewController()
  54. priva.titleStr = "新手指南"
  55. priva.url = "https://game.zhuadd.com/newh5/guide_shengqian.html"
  56. self.navigationController?.pushViewController(priva, animated: true)
  57. }
  58. func gotoStartPage() {
  59. let url = "itms-apps://itunes.apple.com/app/id\(APP_ID)?action=write-review"
  60. let Url = URL(string: url)
  61. UIApplication.shared.openURL(Url!)
  62. }
  63. func gotoBackPage() {
  64. let idea = YMIdeaViewController()
  65. self.navigationController?.pushViewController(idea, animated: true)
  66. }
  67. }
  68. extension YMMyViewController: UITableViewDelegate, UITableViewDataSource {
  69. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  70. return self.dataArr.count
  71. }
  72. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  73. let cell = UITableViewCell.init(style: .default, reuseIdentifier: "cellID")
  74. cell.selectionStyle = .none
  75. let titleStr = dataArr[indexPath.row]["name"]
  76. let imgStr = dataArr[indexPath.row]["image"]
  77. cell.imageView?.image = UIImage(named: imgStr!)
  78. cell.textLabel?.text = titleStr
  79. return cell
  80. }
  81. func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
  82. return 0.0
  83. }
  84. func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  85. switch indexPath.row {
  86. case 0:
  87. self.gotoSettingPage()
  88. break
  89. case 1:
  90. self.gotoNewGuide()
  91. break
  92. case 2:
  93. self.gotoStartPage()
  94. break
  95. case 3:
  96. self.gotoBackPage()
  97. break
  98. default:
  99. break
  100. }
  101. }
  102. func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  103. return 55
  104. }
  105. }