Music_Player3/relax.offline.mp3.music/MP/Common/Tool(工具封装)/MP_DownloadButton.swift
2024-10-08 17:34:04 +08:00

55 lines
1.3 KiB
Swift

//
// MP_DownloadButton.swift
// relax.offline.mp3.music
//
// Created by Mr.Zhou on 2024/9/29.
//
import UIKit
import DownloadButton
///
class MP_DownloadButton: PKDownloadButton {
//()
private var isShow:Bool {
if let statu = UserDefaults.standard.object(forKey: "isShowDownload") as? Bool {
return statu
}else {
return true
}
}
//
private var _isHidden: Bool = false
///
override var isHidden: Bool{
set{
if isShow {
//
_isHidden = newValue
super.isHidden = newValue
}else {
//
}
}
get {
if isShow {
//
return _isHidden
}else {
//
startDownloadButton.isHidden = true
downloadedButton.isHidden = true
stopDownloadButton.isHidden = true
pendingView.isHidden = true
return true
}
}
}
override init(frame: CGRect) {
super.init(frame: frame)
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
}