ios - UIApplicationDelegate but for each ViewController -
i want notified whenever new view controller shown, uiapplicationdelegate provides such way whole app, not each view controllers
is there delegate being called every time new view controller appears?
note
i totally aware of functions inside uiviewcontroller, asking delegate separated view controller itself, applicationdelegate
my attempts
i searched lot, solution comes mind extend viewcontroller, , let view controllers inherit new view controller, prefer if there way catch events without changing in view controllers
there
- (void)navigationcontroller:(uinavigationcontroller *)navigationcontroller didshowviewcontroller:(uiviewcontroller *)viewcontroller animated:(bool)animated;
method in uinavigationcontrollerdelegate
.
swift version:
func navigationcontroller(_ navigationcontroller: uinavigationcontroller, didshow viewcontroller: uiviewcontroller, animated: bool)
you can set uiapplicationdelegate
delegate of uinavigationcontroller
, events there.
Comments
Post a Comment