swift 通知的封装

来源:互联网 发布:淘宝远程解苹果id原理 编辑:程序博客网 时间:2024/05/17 00:17

import UIKit


let center =NSNotificationCenter.defaultCenter()

class ZUONotification:NSObject {


   class func PostZuoNoti(notiName:String,obj:String){

       center.postNotificationName(notiName, object:nil, userInfo: ["key":obj])

    }

   class func AddZuoNoti(notiName:String,objserVer:AnyObject,notiSelect:Selector){

         center.addObserver(objserVer, selector: notiSelect, name: notiName,object:nil)

    }

  

   class func RemoveZuoNoti(objserVer:AnyObject,notiName:String){

    

   center.removeObserver(objserVer, name: notiName, object:nil)

    }

}

0 0