iOS上的UITableViewCell创建

iOS上的UITableViewCell创建,ios,uitableview,allocation,autorelease,Ios,Uitableview,Allocation,Autorelease,我正在UITableView中创建自动发布的UITableViewCell。在表中创建更多行时,会导致内存分配更多。 我试着分配手机,然后在那里释放。它会产生内存泄漏 高效创建UITableViewCell以避免分配和泄漏的解决方案是什么。您需要重用UITableViewCell的: static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = (UITableViewCell *) [tableView dequeueRe

我正在UITableView中创建自动发布的UITableViewCell。在表中创建更多行时,会导致内存分配更多。 我试着分配手机,然后在那里释放。它会产生内存泄漏


高效创建UITableViewCell以避免分配和泄漏的解决方案是什么。

您需要重用UITableViewCell的:

static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = (UITableViewCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

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

请发布CellForRowatineXpath的代码。谢谢说了我想说的关于
UITableViewCell
及其用法的所有内容。