I'm making an app where I add a subview to a view using addSubview:
on an IBAction
. In the same way, when the button with that IBAction
is touched again should call removeFromSuperview
on that subview added on that IBAction
:
PSEUDO CODE
-(IBAction)showPopup:(id)sender
{
System_monitorAppDelegate *delegate = (System_monitorAppDelegate *)[[UIApplication sharedApplication] delegate];
UIView *rootView = delegate.window.rootViewController.view;
if([self popoverView] is not on rootView)
{
[rootView addSubview:[self popoverView]];
}
else
{
[[self popoverView] removeFromSuperview];
}
}