Search code examples
iphonecocoa-touchselectornsnotifications

Sending data to a method registered for a notification


I need to pass some data to a method which I am registering to execute once I receive a notification

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:withCell:) name:UIKeyboardWillShowNotification object:nil];

Here I want to send some data for withCell part of my method.

How can I achieve this?


Solution

  • Short answer: you can't. You're registering for a notification and you can't control what is sent with that notification.

    What is it you would like to do?