前端之家收集整理的这篇文章主要介绍了
swift 广播,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
var obj = Dictionary<String,String>()
obj[Consts.Brocast.NotifyOp] = "222222222222"
NSNotificationCenter.defaultCenter().
postNotificationName(Consts.BrocastName.NotifyCome,object: obj)
func ReceiveNotification(){
NSNotificationCenter.defaultCenter().
name: Consts.BrocastName.NotifyCome,object: nil)
}
func OnReceive(sender :NSNotification){
if let info = sender.object as? NSDictionary{
if let op = info[Consts.Brocast.NotifyOp]
as? String{
let alert:UIAlertView =
UIAlertView(title: op,message: "333333",delegate: self,cancelButtonTitle: "ok")
alert.show()
}
}
}