【发布时间】:2020-11-08 21:33:56
【问题描述】:
我有一个 iOS UINavigationController,其 rootViewController 是 ViewController1。 ViewController1 通过调用pushViewController(_:animated:) 推送ViewController2,然后ViewController2 通过调用popViewController(animated:) 弹出自身。我没有使用故事板。
现在我已经回到ViewController1,我希望ViewController1 自动执行一些操作。
当我们从ViewController2 返回时,如何安排调用ViewController1 的方法?换句话说,ViewController1 怎么能感觉到它刚刚被发现?我知道我可以通过调用UINavigationControllerDelegate 的navigationController(_:didShow:animated:) 方法来做到这一点,但是有更简单的方法吗?
【问题讨论】:
-
同样的问题可以在 StackOverflow 的以下链接stackoverflow.com/questions/50259336/… 上找到。他们使用了协议委托回调方法,在 V2 弹出后调用 V1。
标签: ios swift uinavigationcontroller