【发布时间】:2019-09-20 04:31:08
【问题描述】:
我的一个名为 Message.m 的班级正在发布一个带有对象 sentObject 的通知,如下所示
NSDictionary *sentObject = [NSDictionary dictionaryWithObjectsAndKeys:draftData.arr,@"data", nil];
//Post notification to inform a receiver to reload data
[[NSNotificationCenter defaultCenter] postNotificationName:@"reloadDuringSave" object:self userInfo:sentObject];
DraftData.m 将成为接收通知的接收者,如下所示
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(dataReloaded:)
name:@"reloadDuringSave"
object:nil];
对于发布通知,userInfo 可以是 nil 或 object(如在本例中 sentObject 是 NSDictionary 的类型)。
问题:
addObserver 方法中object 的其他参数是什么?他们可以
除了nil 之外的任何其他内容,如果是,那又是什么?
【问题讨论】:
标签: iphone nsnotificationcenter