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