isBeingDismissed not set in viewWillDisappear:

前端 未结 5 1382
独厮守ぢ
独厮守ぢ 2021-02-13 12:25

I have some code to clean up in my viewWillDisappear:, which I only want to use when the view is moving back to the parent view controller.

- (void)         


        
5条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-13 13:12

    If this is the first view controller in a modal navigation controller that's being dismissed, calling self.isBeingDimissed() from viewWillDisappear: returns false.

    However, since the entire navigation controller is being dismissed, what actually works is self.navigationController?.isBeingDismissed(), which returns true.

提交回复
热议问题