views:

38

answers:

1

Hi, I have a functionality in my table view i.e. when you tap in on cell it loads more cells in below the tapped cell and when you tap again on same cell those added cells gets deleted.

But I have got a strange behavior that when i call below method to delete added cells from table view, the dealloc method of cell isn't being called..(I have placed a NSLog in dealloc method)

[tableView deleteRowsAtIndexPaths:indexPathArray withRowAnimation:UITableViewRowAnimationTop]

and when I call insertRowsAtIndexPaths then new instance of cells are being created, in the instruments I checked that the previous instances remain in memory and new instances are being created again and again.

so please tell me that why is deleteRowsAtIndexPaths not calling release for deleted cell? and some solution for this problem. I am worried because application's real and virtual both memory consumption is keep increasing on continuous taps...

+1  A: 

Hi,

Do you use UITableView's dequeuereusablecellwithidentifier: method in cellForRowAtIndexPath: in order to create new cells?

If not, this is normal. UITableViews keep cells in memory in order to reuse them and avoid having to alloc/dealloc all the time.

You should take a look at this tutorial for example: http://www.mobisoftinfotech.com/blog/iphone/introduction-to-table-view/

Jukurrpa
I was using deque... method, but I missed autorelease method while allocating cell, so issue is now resolved.. Thanks for your reply..
Sanniv