Ios 从SuperView中删除使用ARC时不释放视图

Ios 从SuperView中删除使用ARC时不释放视图,ios,objective-c,uiview,subview,Ios,Objective C,Uiview,Subview,我正在向finalview添加一个子视图,用于更改应用程序的优先顺序。 我从我的最终视图中这样添加它 getPrefrencesViewController = [[GetPrefrencesViewController alloc] init]; getPrefrencesViewController.view setBackgroundColor:[UIColor clearColor]]; getPrefrencesViewController.view.frame = CGRectMa

我正在向finalview添加一个子视图,用于更改应用程序的优先顺序。 我从我的最终视图中这样添加它

getPrefrencesViewController = [[GetPrefrencesViewController alloc] init];
getPrefrencesViewController.view setBackgroundColor:[UIColor clearColor]];

getPrefrencesViewController.view.frame = CGRectMake(0.0, 480.0, 320.0, 480.0);

getPrefrencesViewController.prefToolBar.frame = CGRectMake(0.0, 9.0, 320.0, 45.0);
[getPrefrencesViewController.view addSubview:getPrefrencesViewController.prefToolBar];

getPrefrencesViewController.prefTableView.frame = CGRectMake(0.0, 54.0, 320.0, 435.0);
[getPrefrencesViewController.view addSubview:getPrefrencesViewController.prefTableView];


[self.navigationController.view insertSubview:getPrefrencesViewController.view aboveSubview:self.navigationController.view];




            [UIView animateWithDuration:0.3
                                  delay:0.0f
                                options:UIViewAnimationOptionCurveEaseIn
                             animations:^{

                                 getPrefrencesViewController.view.frame = CGRectMake(0.0, 10.0, 320.0, 480.0);

                             } completion:^(BOOL finished) {
                                 if (finished) {
                                     NSLog(@"YAY!");
                                 }
                             }];
        }
这个很好用

当新视图作为子视图添加时,我有一个UIToolBar,其中有两个按钮“保存”和“取消”,当用户触摸“取消”时,将使用此代码

- (IBAction)cancleUIButton:(id)sender {
    //unload portrait view
    [UIView animateWithDuration:0.4
                          delay:0.0f
                        options:UIViewAnimationOptionCurveEaseIn
                     animations:^{



                         self.view.frame = CGRectMake(0.0, 480.0, 320.0, 480.0); 



                     } completion:^(BOOL finished) {
                         if (finished) {

                             // remove subView for superView
                             [self.view removeFromSuperview];



                         }
                     }];
}
如您所见,我添加子视图,向上设置动画,然后当用户按“取消”时,我设置视图动画,然后将其从superview中删除。。但是,如果我再次加载它,我更改但未保存的所有值仍将更改,这意味着该视图永远不会被删除


我希望有人能告诉我为什么这个观点永远不会被删除?任何帮助都将不胜感激。

在从superview中删除视图后,您是否尝试过将视图设置为nil?必须有另一个指向
self.view
的强指针,它可以使对象保持活动状态,它可以是视图控制器的
视图
ivar。当不再有强指针使对象保持活动状态时,对象将被释放。在superview的
子视图中
数组只是强指针之一。self.view=nil;工作