NSNotificationCenter 选择器参数
我不仅想调用 NSNotification 中的方法,还想调用方法的参数 类似的东西
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerinCombat:YES) name:@"PlayerinCombat" object:nil];
不仅仅是
@selector(playerinCombat:)
为了使用
+ (BOOL)playerinCombat:(BOOL)flag {return flag; if (flag){NSLog(@"Player in Combat.");} if (!flag){NSLog(@"Player not in Combat.");}}
但它不会起作用。有什么想法吗?
I want to call not just methods from NSNotification but the method's arguments
Something along the lines of
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerinCombat:YES) name:@"PlayerinCombat" object:nil];
and not just
@selector(playerinCombat:)
just to use with
+ (BOOL)playerinCombat:(BOOL)flag {return flag; if (flag){NSLog(@"Player in Combat.");} if (!flag){NSLog(@"Player not in Combat.");}}
But it won't work. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
再考虑一下 userInfo 可以使用(我认为)
On second thought userInfo can be used (I think)