swift 广播

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

猜你在找的Swift相关文章