// // MsgCenterViewController.swift // GeliBusinessPlatform // // Created by junye lu on 2020/4/16. // Copyright © 2020 junye lu. All rights reserved. // import UIKit import ViewAnimator class MsgCenterViewController: BaseViewController,NavBarViewDelegate,UITableViewDelegate,UITableViewDataSource { //MARK: -animateView private let animations = AnimationType.from(direction: .bottom, offset: 30.0) var msgTbv:UITableView? override func viewDidLoad() { super.viewDidLoad() let navbar = NavBarView(frame: NavCGRect) navbar.title = "消息中心" navbar.deleagte = self self.view.addSubview(navbar) // Do any additional setup after loading the view. msgTbv = UITableView() msgTbv?.backgroundColor = UIColor(named: "app底色") msgTbv?.delegate = self msgTbv?.separatorStyle = .none msgTbv?.dataSource = self self.view.addSubview(msgTbv!) msgTbv?.snp.makeConstraints({ (make) in make.top.equalTo(NavCGRect.height) make.left.right.bottom.equalTo(0) }) msgTbv?.register(UINib(nibName: "MsgCenterCell", bundle: nil), forCellReuseIdentifier: "MsgCenterCell") } //MARK: -delegate方法 func backAction() { self.navigationController?.popViewController(animated: true) //tabelviewcell进场动画 // UIView.animate(views: msgTbv!.visibleCells, animations:[animations], reversed: false, // initialAlpha: 0, finalAlpha: 1.0, completion: { // self.msgTbv!.reloadData() // }) } //MARK: -Cell delegate方法 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 120 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 10 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "MsgCenterCell") as! MsgCenterCell cell.titleLbl.showSkeleton(transition: .crossDissolve(0.25)) cell.dateLbl.showSkeleton(transition: .crossDissolve(0.25)) cell.contentLbl.showSkeleton(transition: .crossDissolve(0.25)) DispatchQueue.main.asyncAfter(deadline: .now() + 4) { cell.titleLbl.hideSkeleton(reloadDataAfter: true, transition: .crossDissolve(0.25)) cell.dateLbl.hideSkeleton(reloadDataAfter: true, transition: .crossDissolve(0.25)) cell.contentLbl.hideSkeleton(reloadDataAfter: true, transition: .crossDissolve(0.25)) } return cell } }