views:

96

answers:

1

I have UIScrollView with number of subviews. Each subview is custom UIButton with UIImage. When I load more and more subviews, more and more memory is used. But I remove invisible subviews by removeFromSuperView method. Subviews are removed and stay invisible, but Im afraid that no memory is released. UIImage is image downloaded from internet. Thanx for help.

A: 

Are you releasing the UIButton after you put it into the scrollView? Also, what makes you think that no memory is released? Are you releasing the UIImage?

Post some code.

Steven Canfield
I use buttonWithType: method to create new UIButton, so I dont think it is necessary to release it. Am I right? Its almost same with image.
Tankista
Yes that is the correct usage for buttonWithType.What makes you think that removing the subviews is not working?
Steven Canfield
finally I made decision to change just image of the button. I replace it with image saved in bundle via setImage:forState: method. Does it release memory when I change picture by local image?
Tankista