我正在尝试使用NSNotification发送一些数据,但是遇到了问题。下面是我的代码:
// Posting Notification
NSDictionary *orientationData;
if(iFromInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
orientationData = [NSDictionary dictionaryWithObject:@"Right"
forKey:@"Orientation"];
}
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter postNotificationName:@"Abhinav"
object:nil
userInfo:orientationData];
// Adding observer
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(orientationChanged)
name:@"Abhinav"
object:nil];现在如何在我的选择器orientationChanged中获取这个userInfo字典
发布于 2010-10-05 15:21:55
您的选择器必须具有:才能接受参数。
例如:
@selector(orientationChanged:)然后在方法声明中,它可以接受NSNotification参数。
https://stackoverflow.com/questions/3861493
复制相似问题