Skip to content

NSNotification

NSNotification 表示一条通知(name、object、userInfo)。常见于 NSNotificationCenter 的 post/回调参数。

创建无 userInfo 的通知。

static notificationWithNameObject(aName: string, anObject: any): NSNotification

Parameters:

NameTypeDescription
aNamestring通知名。
anObjectany关联对象。

Return Value:

  • NSNotification: 新通知实例。

创建带 userInfo 的通知。

static notificationWithNameObjectUserInfo(aName: string, anObject: any, aUserInfo: NSDictionary): NSNotification

Parameters:

NameTypeDescription
aNamestring通知名。
anObjectany关联对象。
aUserInfoNSDictionary附加信息。

Return Value:

  • NSNotification: 新通知实例。

初始化通知实例。

initWithNameObjectUserInfo(name: string, object: any, userInfo: NSDictionary): void

Parameters:

NameTypeDescription
namestring通知名。
objectany关联对象。
userInfoNSDictionary附加信息。

Return Value:

  • 无。
头文件 API 清单

正在加载…

协议:,来源: