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()
        }
      }
}

你可能感兴趣的:(广播)