What is parameter `object` in NSNotification addObserver:?

前端 未结 3 1618
温柔的废话
温柔的废话 2020-12-29 22:31

One of my class named Message.m is posting a notification with an object sentObject as below

NSDictionary *sentObject = [NSDictionary dictionary         


        
3条回答
  •  孤独总比滥情好
    2020-12-29 23:05

    That "object" parameter to "addObserver" is an optional filter. Upon posting a notification you can set an object to the sender of the notification, and will then only be notified of that sender's events. If set to "nil" you will get all notification of this type (regardless who sent them).

提交回复
热议问题