开发者

When to release row after reloading table data?

This method below works, but I don't know when rowdata should be released.

-(void)refreshTable:(NSMutableArray *) tbdata{
    rowdata=[tbdata retain];
    [tabledata reloadData];
}

This version below causes an error:

-(void)refreshTable:(NSMutableArray *) tbdata{
    rowdata=[[tbdata retain] autorelease];
    [tabledata reloadData];

}

As does this version 开发者_JAVA百科below:

-(void)refreshTable:(NSMutableArray *) tbdata{
    rowdata=[tbdata retain];
    [tabledata reloadData];
    [rowdata release] 
}

When should I release rowdata?


    UITableViewCell *cell = [self.tableview dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) 
{
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];

}

if u created the cell like this then those are autoreleased while scroll up/down (that hiding the cell )

this is for performance reason.

so dont worry about those

in firstLine if the cell with identifier live in memory then while u reload the table it will show them.

if not then again it will create the new one for them

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜