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

swift 通知

2016-02-04 17:24 337 查看
NSNotificationCenter.defaultCenter().addObserver(self,
selector: "noti:", name:
"noti", object: nil)
}

override
func touchesBegan(touches:
Set<UITouch>, withEvent event:
UIEvent?) {
NSNotificationCenter.defaultCenter().postNotificationName("noti",
object: nil, userInfo: ["key1":"value1"])
}

func noti(NSNotification1:NSNotification)->Void{
let value1 = NSNotification1.userInfo!["key1"]!
print("noti--=====\(value1)")
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: