forwarding a notification to another class
Posted
by Mike
on Stack Overflow
See other posts from Stack Overflow
or by Mike
Published on 2010-04-18T18:15:36Z
Indexed on
2010/04/18
18:23 UTC
Read the original article
Hit count: 369
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.
© Stack Overflow or respective owner