문제

I want an NSNotification to be triggered when a non date based event occurs. Any ideas? Thanks!

도움이 되었습니까?

해결책

You have to create an NSNotification and add this notification to the default notification centre. You can do this in that unique line :

[[NSNotificationCenter defaultCenter] postNotificationName:notificationName object:object userInfo:dictionary];

You then have to say to your project that when a notification is sent with the name notificationName, trigger this specific method on my code. And this is done with :

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationMethod) name:notificationName object:object];

There is a full tutorial here.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top