123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- //
- // YMMyViewController.swift
- // MvpGoods
- //
- // Created by 小花 on 2019/4/19.
- // Copyright © 2019 MVP. All rights reserved.
- //
- import UIKit
- class YMMyViewController: YMBaseViewController {
- var tableView: UITableView?
- override func viewDidLoad() {
- super.viewDidLoad()
- self.title = "我的"
- self.view.backgroundColor = UIColor.white
- self.automaticallyAdjustsScrollViewInsets = false
- configTableView()
- configNavBar()
- }
-
-
-
-
- func configNavBar() {
- self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
- self.navigationController?.navigationBar.shadowImage = UIImage()
-
- }
-
-
- func configTableView() {
- let tableView = UITableView(frame: CGRect(x: 0, y: 0, width: SCREENW, height: SCREENH-navHeight-tabBarHeight), style: .plain)
- tableView.estimatedSectionHeaderHeight = 0;
- tableView.estimatedSectionFooterHeight = 0;
- tableView.sectionFooterHeight = 0;
- tableView.sectionHeaderHeight = 0;
- tableView.estimatedRowHeight = 100;
- tableView.delegate = self;
- tableView.dataSource = self;
- tableView.tableFooterView = UIView(frame: CGRect.zero)
- tableView.tableHeaderView = UIView(frame: CGRect.zero)
- tableView.backgroundColor = UIColor.white;
- tableView.showsVerticalScrollIndicator = false;
- tableView.separatorColor = UIColor.hexadecimalColor(hexadecimal: "0xe5e5e5");
- tableView.separatorStyle = .singleLine
-
- self.tableView = tableView
- self.view.addSubview(tableView)
- }
-
- lazy var dataArr: [[String: String]] = {
- let data = [["name":"设置","image":"setting"],
- ["name":"新手指南","image":"zhinan"],
- ["name":"去评分","image":"pingfen"],
- ["name":"意见反馈","image":"guide"]]
- return data
- }()
-
- func gotoSettingPage() {
- let set = YMSettingViewController()
- self.navigationController?.pushViewController(set, animated: true)
- }
-
- func gotoNewGuide() {
- let priva = YMPrivateViewController()
- priva.titleStr = "新手指南"
- priva.url = "https://game.zhuadd.com/newh5/guide_shengqian.html"
- self.navigationController?.pushViewController(priva, animated: true)
- }
-
- func gotoStartPage() {
- let url = "itms-apps://itunes.apple.com/app/id\(APP_ID)?action=write-review"
- let Url = URL(string: url)
- UIApplication.shared.openURL(Url!)
- }
-
- func gotoBackPage() {
- let idea = YMIdeaViewController()
- self.navigationController?.pushViewController(idea, animated: true)
- }
-
-
-
- }
- extension YMMyViewController: UITableViewDelegate, UITableViewDataSource {
- func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- return self.dataArr.count
- }
-
- func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
-
- let cell = UITableViewCell.init(style: .default, reuseIdentifier: "cellID")
- cell.selectionStyle = .none
- let titleStr = dataArr[indexPath.row]["name"]
- let imgStr = dataArr[indexPath.row]["image"]
- cell.imageView?.image = UIImage(named: imgStr!)
- cell.textLabel?.text = titleStr
-
- return cell
- }
-
- func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
- return 0.0
- }
-
- func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
- switch indexPath.row {
- case 0:
- self.gotoSettingPage()
- break
- case 1:
- self.gotoNewGuide()
- break
- case 2:
- self.gotoStartPage()
- break
- case 3:
- self.gotoBackPage()
- break
- default:
- break
- }
- }
-
- func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
- return 55
- }
- }
|