How do I check if an UIViewController is currently being displayed?

前端 未结 7 654
臣服心动
臣服心动 2021-01-01 16:42

How do I check if an UIViewController is currently being displayed?

My UIViewControllers are listening for NSNotifications - e

7条回答
  •  一整个雨季
    2021-01-01 16:55

    Why don't you remove the notification listener in viewWillDisappear and add it in viewWillAppear?

    Edit: misread his question, sorry.

    Suggested answer: set your own flag (BOOL) in viewDidDisappear and viewDidAppear.

提交回复
热议问题