我如何解雇观点?

时间:2011-04-08 09:57:49

标签: objective-c cocoa-touch uiviewcontroller

如果我添加这样的视图:[myView addSubview:viewController.view];如何解除它并获得旧视图。例如,点击按钮

-(IBAction)dismiss{
//some code
}

感谢

2 个答案:

答案 0 :(得分:3)

[viewController.view removeFromSuperview];

答案 1 :(得分:1)

if ([viewController.view superView])

{

      [viewController.view removeFromSuperview];

}