2012-02-21 9 views
0

基本的な質問を申し訳なく思っています。私のデバイスを回転させると、私のIBOutletsを@propertyおよび@synthesizeで変更しないように、私は私のコードを下に提供しました。私はちょうど私のIBOutlets.Isのために私の画像とフレームを変更しています?オリエンテーション変更メモリが増加している間に

-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{ 
      if(UIInterfaceOrientationIsPortrait(self.interfaceOrientation)){ 
       for(UIImageView *thumbImage in [tableSupportView subviews]){ 
         UIImage *tempImage=[bookListDataSource bookAtIndex:thumbnilIndex].titleImage; 
         CGFloat thumbnilHeight=95*((float) tempImage.size.height/tempImage.size.width); 
         thumbImage.frame=CGRectMake(thumbnilIndex*125, (205-thumbnilHeight)/2, 95, thumbnilHeight); 
         thumbnilIndex++; 
       } 
       self.myoutlets.frame=cgrect(frames according to criteria); 
       NSString *detailImagePath=[[NSBundle mainBundle] pathForResource:@"details_bg_nb" ofType:@"png"]; 
       UIImage *detailImage=[[UIImage alloc] initWithContentsOfFile:detailImagePath]; 
       UIColor *bookDetailViewColor=[[UIColor alloc] initWithPatternImage:detailImage]; 
       self.bookDetailView.backgroundColor=bookDetailViewColor; 
       [bookDetailViewColor release]; 
       [detailImage release]; 
       NSString *listBGImagePath=[[NSBundle mainBundle] pathForResource:@"list_bg_nb" ofType:@"png"]; 
       UIImage *listBGImage=[[UIImage alloc] initWithContentsOfFile:listBGImagePath]; 
       UIColor *listHeaderContainerViewColor=[[UIColor alloc] initWithPatternImage:listBGImage]; 
       self.listHeaderContainerView.backgroundColor=listHeaderContainerViewColor; 
       [listHeaderContainerViewColor release]; 
       [listBGImagePath release]; 

       NSString *listBandPath=[[NSBundle mainBundle] pathForResource:@"listband_potrait" ofType:@"png"]; 
       UIImage *listBand=[[UIImage alloc] initWithContentsOfFile:listBandPath]; 
       self.categoryBrandingImageView.image=listBand; 
       [listBand release]; 
      }else { 
       NSUInteger thumbnilIndex=0; 
       NSUInteger numberOfBooks=[bookListDataSource numberOfBooks]; 
       for(UIImageView *thumbImage in [tableSupportView subviews]){ 
         UIImage *tempImage=[bookListDataSource bookAtIndex:thumbnilIndex].titleImage; 
         CGFloat thumbnilHeight=85*((float) tempImage.size.height/tempImage.size.width); 
         thumbImage.frame=CGRectMake(thumbnilIndex*115, (CGRectGetHeight(tableSupportView.frame)-thumbnilHeight)/2.0, 85, thumbnilHeight); 
         thumbnilIndex++; 
        } 
       } 
      self.myoutlets.frame=cgrectmake(my custom frame); 
       NSString *detailImagePath=[[NSBundle mainBundle] pathForResource:@"landscape_details_bg_nb" ofType:@"png"]; 
       UIImage *detailImage=[[UIImage alloc] initWithContentsOfFile:detailImagePath]; 
       UIColor *bookDetailViewColor=[[UIColor alloc] initWithPatternImage:detailImage]; 
       self.bookDetailView.backgroundColor=bookDetailViewColor; 
       [bookDetailViewColor release]; 
       [detailImage release]; 

       NSString *listBGImagePath=[[NSBundle mainBundle] pathForResource:@"landscape_list_bg_nb" ofType:@"png"]; 
       UIImage *listBGImage=[[UIImage alloc] initWithContentsOfFile:listBGImagePath]; 
       UIColor *listHeaderContainerViewColor=[[UIColor alloc] initWithPatternImage:listBGImage]; 
       self.listHeaderContainerView.backgroundColor=listHeaderContainerViewColor; 
       [listHeaderContainerViewColor release]; 
       [listBGImagePath release]; 

       NSString *listBandPath=[[NSBundle mainBundle] pathForResource:@"listband_landscape" ofType:@"png"]; 
       UIImage *listBand=[[UIImage alloc] initWithContentsOfFile:listBandPath]; 
       self.categoryBrandingImageView.image=listBand; 
       [listBand release]; 
      } 
      self.bookInformation.backgroundColor=[UIColor clearColor]; 
      self.bookDescrption.backgroundColor=[UIColor clearColor]; 
     } 
    } 

任意の漏れがない場合には、事前に私にsolution.Thanksが提供してくださいです。

+2

聖ブロックの代わりにバットマンをlistBGImageを解放する必要があります! –

答えて

1

コードのこの部分では、あなたは間違いを持っ​​ている -

NSString *listBGImagePath=[[NSBundle mainBundle] pathForResource:@"landscape_list_bg_nb" ofType:@"png"]; 
UIImage *listBGImage=[[UIImage alloc] initWithContentsOfFile:listBGImagePath]; 
UIColor *listHeaderContainerViewColor=[[UIColor alloc] initWithPatternImage:listBGImage]; 
self.listHeaderContainerView.backgroundColor=listHeaderContainerViewColor; 
[listHeaderContainerViewColor release]; 
[listBGImagePath release]; 

あなたは、コードのlistBGImagePath

+0

これは2回現れます。 – beryllium

+0

+1ベリリウムありがとう。私の間違いに同意する。 – ajay

関連する問題