我想在NSNotification的userinfo字典中传递UIInterfaceOrientation对象。我怎样才能做到这一点?
答案 0 :(得分:3)
将其包裹在NSNumber中:
id orientationObject = [NSNumber numberWithInteger:UIInterfaceOrientationPortrait];
[userinfo setObject:orientationObject forKey:@"orientation"];
// pass around ...
UIInterfaceOrientation orientation = (UIInterfaceOrientation)[[userinfo objectForKey:@"orientation"] integerValue];