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

swift 广播

2015-08-08 11:50 585 查看
[code]var obj = Dictionary<String,String>()
obj[Consts.Brocast.NotifyOp] = "222222222222"
NSNotificationCenter.defaultCenter().
postNotificationName(Consts.BrocastName.NotifyCome, 
object: obj)


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