Iphone 缓存的UITableView元素

Iphone 缓存的UITableView元素,iphone,objective-c,ios,uitableview,memory-management,Iphone,Objective C,Ios,Uitableview,Memory Management,我有一个包含1000个元素的UITableView。在第一次加载之前,仪器显示仍有2.20MB的字节处于活动状态。充电后显示为4.82MB。当我释放内存并返回到以前的状态时,它显示为4.71MB。但现在,当我加载同一个表时,仪器再次显示4.82MB。UITableView的结构是否存储在缓存中?如果是,是否有办法释放此内存 我的表格结构: (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS

我有一个包含1000个元素的UITableView。在第一次加载之前,仪器显示仍有2.20MB的字节处于活动状态。充电后显示为4.82MB。当我释放内存并返回到以前的状态时,它显示为4.71MB。但现在,当我加载同一个表时,仪器再次显示4.82MB。UITableView的结构是否存储在缓存中?如果是,是否有办法释放此内存

我的表格结构:

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

    static NSString *MyIdentifier = @"SearchResult";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];

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

    if(!isSomeStateSearching) cell.textLabel.text = [[[contentSomeState objectAtIndex:indexPath.section] objectForKey:@"rowValues"] objectAtIndex:indexPath.row];
    else
    {
        cell.textLabel.text = [searchedAllContent objectAtIndex:indexPath.row];
    }

    UIView *v = [[[UIView alloc] init] autorelease];
    v.backgroundColor = [UIColor colorWithRed:188/255.0 green:57/255.0 blue:25/255.0    alpha:1.0];
    cell.selectedBackgroundView = v;

    UIImageView *arrow = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"seta_navegacao"]] autorelease];
    cell.accessoryView = arrow;

    return cell;
}

当然,您正确地使用了
UITableViewCell的重用机制,对吗?

您应该仅在初始化新单元格时分配和添加单元格子视图。目前,每次重用单元时,您都在创建新视图和图像视图。这就是为什么你的桌子占用了这么多内存

是的,我要补充一个问题。问题不在于占用太多的内存。问题是内存最终没有释放。我可以在代码末尾对视图和imageview进行注释,问题仍然存在。