I am trying to listen for UIViewController
methods being triggered (-viewDidLoad
, -viewDidAppear
, -viewDidUnload
, -viewDidDisappear
and so on) without modifying the actual code in the methods. Is this impossible? I'm trying to have an observer in another class listen in for those methods being called, but I don't开发者_Go百科 want to add postNotifications:
to the View Controller. Do I have to?
No, it is not possible. You will have to add postNotifications:
I'm afraid.
I'd subclass the UINavigationController to post the notifications you want. Alternatively I'd use swizzling with a category to add the notifications without touching the code of the class
精彩评论