iOS release an array of uimageviews

juanchofern

macrumors newbie
Original poster
Jan 30, 2012
3
0
Hello i have an array of uiimage views in a function.

But the problem is when i call the function is sometimes i would like
to change the images, so how could i do it and releasing the memory
to avoid memory leaks.

FicherosBolasGrises is a NSMutable array of strings where i save the names
Of the images files.

In another function if i need it i change the images in FicheroBolasGrises,
The problem is when i call the function to assign the images to the array
of image views i have memory leaks because i have not releases before, how i could release the array of image views to avoid memory leaks?
Any help?

Thanks a lot

this is my function
Code:
fullarray
{
imageBolaGris = [ImageCache loadImage:[ficherosBolasGrises objectAtIndex:i]];	

tBolasGrises[i] = [[UIImageView alloc] initWithImage:imageBolaGris];
}
Thanks a lot for your help
 
Last edited by a moderator:

robbieduncan

Moderator emeritus
Jul 24, 2002
24,990
299
Harrogate
Hello, that i tried this way, inside the loop, but it doesn´t work.

Could you help me? Thanks a lot.

[tBolasGrandes release];


You need to consider what you are asking. If a user reported a problem with your app as "it doesn't work" would you consider that a good bug report or less than helpful and want to smack them round the head? To be clear:

What did you expect to happen? Explain in detail. What actually happened and how did this differ from what you expected. Again explain in detail. What have you done to debug the problem (note if the answer is nothing you will get no help): explain each step you have taken to debug the problem, the results you got and what that tells you.

Are there error messages? If so what are they.

Basically: learn to provide the detail required to assist or expect to get little back.
 

juanchofern

macrumors newbie
Original poster
Jan 30, 2012
3
0
You need to consider what you are asking. If a user reported a problem with your app as "it doesn't work" would you consider that a good bug report or less than helpful and want to smack them round the head? To be clear:

What did you expect to happen? Explain in detail. What actually happened and how did this differ from what you expected. Again explain in detail. What have you done to debug the problem (note if the answer is nothing you will get no help): explain each step you have taken to debug the problem, the results you got and what that tells you.

Are there error messages? If so what are they.

Basically: learn to provide the detail required to assist or expect to get little back.


Do you know how can i release the array of uimageviews when i want
to change the images?

The array is Style Old C.

Code:
UIImageView tBolasGrandes[5];

this is my code

Code:
for (int i =0; i<5;i++)
                {
imageBolaGrande = [ImageCache loadImage:[ficherosBolasGrandes objectAtIndex:i]];

tBolasGrandes[i] = [[UIImageView alloc] initWithImage:imageBolaGrande];
                }
so in another function i would like to change ficherosbolasGrandes to assign
new images.

ficherosBolasGrandes is a NSMutableArray. This is not a problem, i can
release ficherosBolasGrandes and add new images.

Then after i would like to release tBolasGrandes to avoid memory leaks and assign the new images from ficherosBolasGrandes.

Could you help me please?

Thanks a lot, and regards.
 
Last edited by a moderator:

robbieduncan

Moderator emeritus
Jul 24, 2002
24,990
299
Harrogate
You have not answered any of the questions I asked. You said you had tried. Where is this code? What did not work? How did you try and debug it?

If you expect someone else to write your code for you then I think you will be out of luck.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.