sorry to asking basic question.In my viewcontroller memory is going up when i rotate my device to prevent that I modified all my IBOutlets with @property and @synthesize even that also not working still my allocation are going peak i dont know what mistake i did in didrotate method I provided my code below.Here i am just modifying my images and frames for my IBOutlets.Is there any wrong in the below provided code?
-(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];
}
}
if any leaks is there please provide me the solution.Thanks in Advance.
In this part of code you have a mistake –
You have to release
listBGImageinstead oflistBGImagePath