Music_Player3/relax.offline.mp3.music/MP/MPPositive/Views/Base/MPPositive_BaseShowView.swift
2024-08-09 17:48:28 +08:00

40 lines
1.2 KiB
Swift

//
// MPPositive_BaseShowView.swift
// relax.offline.mp3.music
//
// Created by Mr.Zhou on 2024/8/9.
//
import UIKit
class MPPositive_BaseShowView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
NotificationCenter.notificationKey.add(observer: self, selector: #selector(switchCurrentVideoAction(_ :)), notificationName: .positive_player_reload)
}
///
@objc private func switchCurrentVideoAction(_ notification:Notification) {
DispatchQueue.main.async {
[weak self] in
guard let self = self else {return}
//ViewtableView
subviews.forEach { item in
if item is UITableView {
let tableView = item as? UITableView
tableView?.reloadData()
}else if item is UICollectionView {
let collectionView = item as? UICollectionView
collectionView?.reloadData()
}
}
}
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
deinit{
NotificationCenter.default.removeObserver(self)
}
}