0

I used several UIStoryboard in my app, but I found that when I changed the storyboard, the old did not released ,how to release the old one? the following is the code:

if([ModuleTeacher isEqualToString:type]){
    [self loginStateChanged];

    if([TeacherProfile getCurrentTeacher]!=nil){
        [self startPull];
    }
}else if([ModuleStudent isEqualToString:type]){
    UIStoryboard *main = [UIStoryboard storyboardWithName:@"StudentMain" bundle:nil];
    self.window.rootViewController = [main instantiateInitialViewController];

    if([StudentProfile getCurrent]!=nil){
        [self startPull];
    }
}else if([ModuleOrgnization isEqualToString:type]){
    UIStoryboard *main = [UIStoryboard storyboardWithName:@"OrganizeMain" bundle:nil];
    self.window.rootViewController = [main instantiateInitialViewController];
    [AppCache setModule:type];
}

this way the old storyboard will be never released.

4

1 回答 1

0
  1. 使用弧。

  2. 如果您对不再需要的情节提要有任何强引用,请将它们设置为 nil。

  3. 没有第 3 步。

ARC 将确保您释放不再需要的任何引用。确保在不需要时清除您的强引用让 ARC 做正确的事情。如果您的代码不负责保留情节提要,则您不负责发布任何内容。Cocoa Touch 框架可能由于其自身原因而挂在情节提要上——这不是您的问题。

于 2013-07-28T13:29:28.973 回答