简体   繁体   English

从视图中删除Xib文件

[英]Remove xib file from view

I am loading a xib file from my viewcontroller which has a table view. 我正在从具有表视图的viewcontroller加载一个xib文件。

[[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. 在按钮上,单击要删除此视图的newView。

[self.newView removeFromSuperview];

The newView is removed. newView被删除。 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];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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