사용자 정의 셀에로드 할 변수에 계속 액세스하는 데 문제가 있습니다. InSeasonCell이라는 xib, .h, .m이 있습니다. IBOutlet InSeasonCell * _cell이 있습니다. .h의 rootviewcontroller에 있습니다. 내 productAtIndex 값에 액세스 할 때 lldb 오류가 발생합니다. 어떤 도움이라도 좋을 것입니다. Table View 프로그래밍 가이드를 읽으라고했습니다.iOS : 사용자 정의 셀 lldb 메모리 액세스 오류
은 내가 rootviewcontroller에서 초기화하지만 제품의 개체를 채 웁니다 타 객체에 전달
_dataController = [[InSeasonProductDataController alloc] init];
을 만들 수 있습니다.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"InSeasonCell";
InSeasonCell *cell = (InSeasonCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:CellIdentifier owner:self options:nil];
cell = _cell;
_cell = nil;
}
if(_dataController!=nil){
Product *productAtIndex = [_dataController objectInListAtIndex:indexPath.row];
// Configure the cell...
cell.name.text = productAtIndex.name;
cell.week.text = productAtIndex.week;
cell.image.image = productAtIndex.image;
}
return cell;
}
나는 나의 코드를보고 내가 다른 하나 개의 클래스에서 생성 된 객체를 전달하고 있음을 발견했다. 예를 들면 :
-(id)initWithDataController:(InSeasonProductDataController *)dataController spinner: (UIActivityIndicatorView *)spinner{
if(self = [super init]){
_dataController = [dataController retain];
_spinner = [spinner retain];
}
return self;
}
_dataController은이 방법의 뒷부분에서 제품 객체로 채워 도착 및 해제됩니다. 당신이하는 .m 파일에 가지고
이미 답변을 수락 한 이전 질문 인 http://stackoverflow.com/questions/15726970/ios-lldb-exc-bad-access-custom-cell과 어떻게 다른가요? –
'registerNib : ... '를 사용하면 커스텀 테이블 뷰 셀을로드하는 데 훨씬 쉬운 방법이라는 것에주의하십시오. http://stackoverflow.com/a/15591474/1187415. –
확인. 고맙습니다. 한번보세요. – wwjdm