Pergunta

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).

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top