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)")
}
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)")
}
相关文章推荐
- swift获取屏幕分辨率
- swift 单例模式正确写法
- oc 调用 swift Demo
- Swift语言指南--可选值
- swift创建一个空项目
- swift 函数 做参数,函数做返回值
- swift构造方法
- Swift_UINavigationController
- swift调用OC语法
- iOS开发用swift添加admob广告,iosswiftadmob广告
- SWIFT学习笔记01
- swift懒加载
- swift菜鸟入门视频教程-07-闭包
- Swift类与结构、存储属性、计算属性、函数与方法、附属脚本等
- Swift: 是用Custom Segue还是用Transition动画
- Swift: 是用Custom Segue还是用Transition动画
- App运行过程中需要更改System Setting(swift)
- Swift 2.0 函数 定义、调用、参数返回值、函数类型、嵌套函数
- Swift之UITabBarController 导航控制器的自定义
- Swift快速入门(一)第一个Swift程序