您的位置:首页 > 移动开发 > Swift

swift 通知的封装

2016-02-19 10:27 381 查看
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)
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: