iOS how to detect programmatically when top view controller is popped?

后端 未结 10 1318
逝去的感伤
逝去的感伤 2020-12-04 17:32

Suppose I have a nav controller stack with 2 view controllers: VC2 is on top and VC1 is underneath. Is there code I can include in VC1 that will detect that VC2 has just be

10条回答
  •  眼角桃花
    2020-12-04 18:13

    What are you specifically trying to do?

    If you're trying to detect that VC1 is about to be shown, this answer should help you. Use UINavigationControllerDelegate.

    If you're trying to detect that VC2 is about to be hidden, I would just use the viewWillDisappear: of VC2.

提交回复
热议问题