質問
OBJ-Cのシステムにすべての通知を印刷するにはどうすればよいですか?
[[NSNotificationCenter defaultCenter] addObserver:self ...];
「...」では何がありますか? nsdistributednotificationcenterを使用する必要がありますか?
nslog(@"ok")を実行するLogfuncという関数があるとしましょう。
ありがとうございました
解決
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMethod:) name:nil object:nil];
次に、次のようなセレクターに一致するメソッドを定義できます。
- (void)myMethod:(NSNotification *)notification {
NSLog(@"notification received: %@", notification);
}
所属していません StackOverflow