扫码关注官方订阅号
认证0级讲师
你的用法错了NSNotificationCenter 的使用1,定义一个方法-(IBACtion)shuchu{ }2,对象注册,并附带信息[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(shuchu) name:@"NotificationName" object:nil];3,发送通知信息[[NSNotificationCenter defaultCenter] postNotificationName:@"NotificationName" object:nil];4,dealloc中删除通知[[NSNotificationCenter defaultCenter] removeObserver:self];
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
你的用法错了
NSNotificationCenter 的使用
1,定义一个方法
-(IBACtion)shuchu{ }
2,对象注册,并附带信息
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(shuchu) name:@"NotificationName" object:nil];
3,发送通知信息
[[NSNotificationCenter defaultCenter] postNotificationName:@"NotificationName" object:nil];
4,dealloc中删除通知
[[NSNotificationCenter defaultCenter] removeObserver:self];