40 lines
1.2 KiB
Swift
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}
|
|
//检索当前View内部是否存在tableView
|
|
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)
|
|
}
|
|
}
|