发送通知:
NotificationCenter.default.post(name: NSNotification.Name("PostCommentNotification"), object: self, userInfo: ["height": self.frame.height])
注册接收:
NotificationCenter.default.addObserver(self, selector: #selector(self.postCommenNotice), name: NSNotification.Name(rawValue: "PostCommentNotification"), object: nil)
//MARK:- 请求通知处理
@objc func requestNotData(notification : NSNotification){
if let dict = notification.userInfo {
self.closePostView()
var statusType = ""
if let status = dict["status"] as? String {
statusType = status
}
if let tag = dict["tag"] as? String {
if tag == "post" {
self.closePostView()
}
}
if let msg = dict["msg"] as? String {
self.hideProgress()
if statusType == "error" {
self.showErrorSingle(msg: msg)
}
if statusType == "warn" {
self.showWarn(msg: msg)
}
}
}
}