How to pass userInfo in NSNotification?

后端 未结 4 1014
甜味超标
甜味超标 2020-12-23 19:36

I am trying to send some data using NSNotification but get stuck. Here is my code:

// Posting Notification
NSDictionary *orientationData;
if(iFromInterfaceOr         


        
4条回答
  •  情话喂你
    2020-12-23 20:21

    You are posting the notification correctly. Please modify the Notification Observer like following.

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:)
     name:@"Abhinav" object:nil];
    
    - (void)orientationChanged:(NSNotification *)notification
    {
        NSDictionary *dict = [notification userInfo];
    }
    

    I hope, this solution will work for you..

提交回复
热议问题