2012-03-09 3 views
0

写真とモーションのあるブックのようなアプリケーションを開発しています。私は18ビューを持って、各ビューはより多くの実際のメモリ(最大70メガバイト)です。このコードの開発のイメージがある70MBのメモリと18のViewController sdk

画像:

fonsImatge = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"fons_pis.png", 0] ofType:nil]]]; 
    [fonsImatge setFrame:CGRectMake(0, 0, 1024, 768)]; 
    fonsImatge.alpha = 1.0f; 
    //[UIView commitAnimations]; 
    [self.view insertSubview:fonsImatge atIndex:0]; 
    [fonsImatge release]; 


letra_a = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"lletra_a_01.png"]]; 
    [letra_a setFrame:CGRectMake(406, 114, 270, 318)]; 
    [self.view insertSubview:letra_a atIndex:2]; 
    [letra_a release]; 
    letra_a.alpha = 0.0; 
    letra_a.animationImages = [NSArray arrayWithObjects:  
           [UIImage imageNamed:@"lletra_a_01.png"], 
           [UIImage imageNamed:@"lletra_a_02.png"],nil]; 
    letra_a.animationDuration = 5.00; 
    letra_a.animationRepeatCount = 1000; 
    [letra_a startAnimating]; 

次のビュー:

proj_lletrac_fosca *viewController = [[proj_lletrac_fosca alloc] init]; 
    [self presentViewController:viewController animated:NO completion:nil]; 
    [viewController release]; 


- (void)viewDidUnload { 
    self.fonsSemi=nil; 
    self.fletra_a=nil; 
} 

私は前のビューのメモリを削除するにはどうすればよいですか?

ありがとう!!!!

+0

どのバージョンのXcodeを使用していますか?また、ARC(Automatic Reference Counting)を使用していますか? –

+0

Xcodeが4.2.1、ARCを使用していません – adagio20

+0

ARCはどうですか? –

答えて

1

つまり、明示的には行いません。すべてのビューコントローラでviewDidUnloadを実装し、viewDidLoadに再度作成できるものをリリースする必要があります。その後、UIKitは正しいことを行い、メモリが逼迫しているときに画面に表示されないビューをアンロードします。

+1

- (void)viewDidUnload { self.fonsSemi = nil; self.fletra_a = nil; } – adagio20

関連する問題