Although I declared the UIView in the header file (as below):
IBOutlet UIView *aCustomMsgBoxView;
The RemoveSuperView works in one method but not in the other. It works if I put it in this method:
-(IBAction)showMsgBox:(id)sender
{
vc = [ViewController sharedInstance].self;
aCustomMsgBoxView = [[UIView alloc] init];
NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"customMsgBox" owner:self options:nil];
aCustomMsgBoxView = [nibObjects objectAtIndex:0];
aCustomMsgBoxView.frame = CGRectMake(35, 80, 250, 146);
[vc.view addSubview:aCustomMsgBoxView];
}
But I don’t need it in the above method, I need it in the method below where it doesn’t work:
-(IBAction)hideMsgBox:(id)sender
{
[newAnnotationTitle resignFirstResponder];
[aCustomMsgBoxView removeFromSuperview];
}
Of course both methods sit in the same class…
Why isn’t the view being removed from the screen??
Following code may be help for remove UIView (aCustomMsgBoxView)
Thanks 🙂