I have an app which I add a subview to (and remove the same subview based on user interactions). I am looking for a way to check whether the subview is present or not at any given time.
For example:
In the current view (UIView *viewA
) I add a subview (UIView *viewB
). I then want a way of checking whether viewB
is being displayed at any given time.
Sorry if this isn't very clear, it's quite hard to describe.
an UIView
stores its superview and is accessible with the superview
-property just try
if([viewB superview]!=nil)
NSLog(@"visible");
else
NSLog(@"not visible");
But the better approach is to use the hidden
-property of UIView