我在view中创建了一个新的view1,然后addsubview之后怎么处理view1才好?
   
     CustomViewController *customViewController = [[CustomViewController alloc] initWithNibName:@"CustomViewController "];
     [self.view addsubview:customViewController.view];
     [customViewController release];     如上:如果我release customViewController self.view 上面显示的会只有一个customViewController.view的一个最上面的toolbar跳显示。可是如果我不release的话,会出现内存泄露吧。这个要怎么处理好。
     我有用 [[[CustomViewController alloc] initWithNibName] autorelease] 效果与后面release是一样的。
     求高手指点好的解决方案,最好讲解一下具体的原因,不胜感激。

解决方案 »

  1.   

    ”customViewController.view的一个最上面的toolbar跳显示“  这是什么意思?
      

  2.   

    customViewController.view的一个最上面的toolbar跳显示“ 这是什么意思?
       customViewController.view中有toolbar的,在后面release掉它之后,最后的显示结果会是,只显示了customViewController.view的toolbar,其他的没有显示出来。
      

  3.   

    3楼正解。不过你的【customViewController 】是局部的,需要在创建的时候要么创建成类变量,要么在创建的时候保存下来,留着【removeFromSuperview】的时候用。
      

  4.   

    我们对由 UIViewController 持有的 View 都不会去处理的。
      

  5.   

    customViewController 直到不用的时候才release,不然你就不能control你的view。
      

  6.   

    一般都不会在这里面release的应该是其他地方内存泄露了吧