문제

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

도움이 되었습니까?

해결책

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

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