How do I check if an UIViewController
is currently being displayed?
My UIViewControllers
are listening for NSNotifications
- even if when they are not displayed (ie not shown). So I could have 10 UIViewController
in the background observing NSNotifications
from NSNotificationCenter
. When an NSNotification
is posted and received by the UIViewController
, I'd like to find out if it is currently being shown. If it is not, I will just set a boolean so that it will processed when the View is presented. If it currently being display, I will do more things like update tables immediately, and so forth...
topViewController
fromUINavigationController
class. Or if you want to process more then one controller enumerateviewControllers
array. – AndroidNSNotifications
, create aBOOL
calledisVisible
and set the value whenviewDidAppear
andviewDidDisappear
are called? Then in yourviewWillAppear
(or wherever) you can just check yourBOOL
and loose a whole lot of complexity. – Zonked