Ios 为什么当我从SuperView中移除时,内存仍然保留?
我目前正在做一个ipad项目,发现了这个。 这就是我的结构 我将uiviewcontroller子类化为customizedVC,如下所示Ios 为什么当我从SuperView中移除时,内存仍然保留?,ios,memory-management,Ios,Memory Management,我目前正在做一个ipad项目,发现了这个。 这就是我的结构 我将uiviewcontroller子类化为customizedVC,如下所示 @protocol customizedVCDelegate -(void)viewclosed:(UIView *)view oldviewcontroller:(UIViewController *)oldvc newvcname:(UIViewController *)newvc; @end @interface customizedVC :
@protocol customizedVCDelegate
-(void)viewclosed:(UIView *)view oldviewcontroller:(UIViewController *)oldvc newvcname:(UIViewController *)newvc;
@end
@interface customizedVC : UIViewController {
id <customizedVCDelegate> delegate;
}
@property (assign) id <customizedVCDelegate> delegate;
@end
要切换视图,我将在每个viewcontroller中启动viewClosed。例如,我得到了VC1,想切换到VC2。我在vc1中启动一个关闭的视图。由于vc1的委托是DemoiPadapDelegate,实际上所有vc的委托都是DemoiPadapDelegate。因此,DemoiPadapDelegate将接收事件并执行此操作。这是在DemoiPadapDelegate中
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//loading openvinview
openingVC *vc = [[openingVC alloc] initWithNibName:@"openingview" bundle:nil];
vc.delegate = self;
[window addSubview:vc.view];
[window makeKeyAndVisible];
return YES;
}
-(void)viewclosed:(UIView *)view oldviewcontroller:(UIViewController *)oldvc newvcname:(UIViewController *)newvc;
{
self.currentVC = (customizedVC *)newvc;
self.currentVC.delegate = self;
[window addSubview:self.currentVC.view];
[view removeFromSuperview];
[oldvc release];
}
我原以为记忆的使用会减少。没有。
我还检查了每个vc,我已经手动释放了我分配的任何东西。事实并非如此
对不起,我的英语很差,我希望我已经解释清楚了,你确定你用的是正确的大小写吗
方法被调用,而不是
从SuperView中移除是否确实使用了正确的大小写
方法被调用,而不是从SuperView移除是的,大小写是正确的,不是由拼写引起的,但是无论如何谢谢是的,大小写是正确的,不是由拼写引起的,但是无论如何谢谢