forwarding a notification to another class
- by Mike
I am using this method
- (void)keyboardWillShow:(NSNotification *)notification
that is triggered when the keyboard shows.
When this method is triggered, it receives a notification that contains several parameters about the keyboard, as the animation duration, animation curve and frame. I need to forward this notification and all its parameters to another class. So, I've tried to do this inside keyboardWillShow:
[[NSNotificationCenter defaultCenter]
postNotificationName:@"doSomething" object:notification userInfo:nil];
the doSomething notification runs doSomething method on another class, and it has this form:
- (void) doSomething:(NSNotification *)notification {
but when I try to read the notification values on this other class, using, for example,
myRect = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
I obtain zero for all values. The notification is losing its parameters and not being forwarded. How can I do that?
thanks.