Question

How can I create a new, custom NSUserNotificationCenter instance? I don't mean [NSUserNotificationCenter defaultUserNotificationCenter], I mean something like [NSUserNotificationCenter new] (which doesn't work, for me).

Était-ce utile?

La solution

you cannot do this BECAUSE the class that is the real NotificationCenter is NOT the class NSUserNotificationCenter. :)

The user notification center that does the real work is the private class _NSConcreteUserNotificationCenter

which is what you get back by default. [NSUserNotificationCenter defaultUserNotificationCenter] => gets t_NSConcreteUserNotificationCenter

the [NSUserNotificationCenter defaultUserNotificationCenter] is a factory method and not just a short way to do alloc/init

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top