0
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"LibraryListingCell";
InSeasonCell *cell = (InSeasonCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"InSeasonCellView" owner:self options:nil];
cell = [_cell autorelease];
_cell = nil;
}
if(_dataController!=NULL){
Product *productAtIndex = [_dataController objectInListAtIndex:indexPath.row];
// Configure the cell...
if (productAtIndex.name != nil && productAtIndex.week != nil && productAtIndex.image != nil) {
cell.name.text = productAtIndex.name;
cell.week.text = productAtIndex.week;
cell.image.image = productAtIndex.image;
}
}
return cell;
}
消息ERROR爲cell.name.text cell.week.text cell.image.text。很確定這是一個內存管理錯誤。盡我所知,我保留並正確發佈。應用程序在啓動時會崩潰,有時會加載一切正常,但是當您滾動它時會崩潰。任何關於內存管理的幫助或指針,我都讚賞。的iOS:LLDB EXC_BAD_ACCESS自定單元
_cell是一個自定義的UITableViewCell和訪問它作爲一個IBOutlet。我不認爲我必須發佈一個IBOutlet或分配一個。我會嘗試使用IBOutlet而不釋放它。 – wwjdm
我正在使用本教程http://www.iphonedevcentral.com/customize-that-uiviewcell-part-1-using-interface-builder/。 – wwjdm
有一個自定義單元格.h .m和xib文件。我將如何加載(自定義xib),而不是創建一個新的UITableViewCell – wwjdm