简体   繁体   中英

Remove xib file from view

I am loading a xib file from my viewcontroller which has a table view.

[[NSBundle mainBundle] loadNibNamed:@"NewView" owner:self options:nil])
    [self.newView setFrame:CGRectMake(0, 0, 320, 480)];
    [[UIApplication sharedApplication].keyWindow addSubview:self.newView];

The view is correctly loaded. On a button click in the newView I want to remove this view.

[self.newView removeFromSuperview];

The newView is removed. But the tableview behind it doesn't show anything. It just shows a transparent background. Cant find a way to sort it. Help needed

This code worked.

[[NSBundle mainBundle] loadNibNamed:@"NewView" owner:self options:nil];
[self.newView setFrame:CGRectMake(0, 0, 320, 480)];
[self.view addSubview:newView];

And I removed the view by

[self.newView removeFromSuperview];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM