开发者

Tableviecells are not getting deallocted.....Memory Management issues

I am working on an application in which uitableviewcells of uitableview are customized which contains a textfied(contains managedobject/core data), label((contains managedobject), buttons so all are customized. i am creating uitableview dynamically using sqlite.

My tablview UI http://grab.by/FiJ

Similarly uitableview view contains more than 15 cells. Cell开发者_StackOverflows are displayed perfectly. but i am facing problem with the memory occupied by cells.

And if i tab on next/prev the same table view is getting reloaded with new cells(also new data) using core data. But in this case previous cells(memory of cells) should be deallocted. But memory is getting increase and increase continuously while navigating to other views(using prev/next button).

Strange thing is, When i scroll tablview continuously up and down cells are created and created, and memory is increasing gradually.

Thanks.


I think that

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 

works incorrectly.

Check that your cells have same cell Identifier (You can specify it in IB) that you use in code:

static NSString *cellIdentifier = @"myIdentifier";
MyCell* cell = (MyCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
         if (cell == nil) {
            cell = [[[MyCell alloc] init] autorelease];
         }
cell.text = @"Yahoo!";
...

I think that this is your problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜