//
//  TableView.swift
//  MusicPlayer
//
//  Created by Mr.Zhou on 2024/4/11.
//

import UIKit

extension UITableView {
    /// tableView刷新时触发（适用单独section）
    /// - Parameter count: 显示cell数量
    func showMessage(_ count:Int, title:String = "No data"){
        if count == 0 {
            let view = UIView()
            view.frame = frame
            view.backgroundColor = .clear
            //显示图片
            let imageView = UIImageView(image: UIImage(named: "empty"))
            imageView.contentMode = .scaleAspectFill
            view.addSubview(imageView)
            imageView.snp.makeConstraints { make in
                make.centerX.equalToSuperview()
                make.centerY.equalToSuperview().multipliedBy(0.9)
                make.width.equalTo(211*width)
                make.height.equalTo(172*width)
            }
            backgroundView = view
        }else{
            backgroundView = nil
        }
    }
}
