更新时间:2022-06-25 23:24:11
您需要检查您的视图控制器是否位于导航控制器的视图控制器数组的堆栈顶部.示例代码是,
You need to check if your viewcontroller is on top of the stack of navigationcontroller's viewcontroller array. A sample code is,
if (self.navigationController.topViewController == self) {
//the view is currently displayed
}
您可以在 viewWillAppear
方法中使用它来检查当前视图是否可见.
You can use this inside the viewWillAppear
method to check whether the current view is visible.