Removing views from superview is important [did receive memory warning]

Consider the case where you have multiple views stored in a mutable array. You keep creating and storing the views in this array itself. 

When you don’t want to use it you would do, remove all objects from the array. 

This is helpful up to an extent. I would always recommend you do a for loop for the views, remove each view individually from the superview and then do remove all objects. This would definitely reduce your consumption of memory. 

Leave a Reply

Your email address will not be published. Required fields are marked *