我在我的ViewController中添加了一个子视图(ViewController):
Location *location = [[Location alloc] initWithNibName:@"Location" bundle:[NSBundle mainBundle]];
[self.subView addSubview:location.view];
如何删除此子视图?
我知道删除所有子视图的方式是:
for (UIView *subview in [self.view subviews]) {
[subview removeFromSuperview];
}
location
视图控制器或view
本身的引用,这样你就不需要遍历子视图了... - Paul.s