2014-07-15 3 views
-1

을 스크롤 할 때 UITableView가 충돌 함 이것은 github에서 가져온 코드이며 내가 주석 처리 한 코드에서 오류가 발생합니다. EXC BAD ACCESS는 무언가를 유지하거나 해제하지만 ARC를 사용하도록 설정했기 때문에 발생합니다. 나는 무엇을 해야할지 모른다.github에

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
static NSString *cellIdentifier = @"Cell"; 

CountryCell *cell = (CountryCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier]; 

if(cell == nil) { 
    cell = [[CountryCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIdentifier]; 
} 

cell.textLabel.text = [[_dataRows objectAtIndex:indexPath.row] valueForKey:kCountryName]; //here crashes 
cell.detailTextLabel.text = [[_dataRows objectAtIndex:indexPath.row] valueForKey:kCountryCallingCode]; //here crashes 

return cell; 

}

+0

는 github에 당신이 가진 다운로드했습니다 파일합니까 ARC 지원이 필요합니까? – GenieWanted

+0

아무 말도하지 않는다.이게 하나이다. https://github.com/pradyumnad/Country-List/blob/master/README.md – Elgert

+0

당신은 이드를 의미합니까? 나던 tableview로드 된 있지만 스크롤 할 때 발생합니다 – Elgert

답변

3

내가 라벨에 텍스트 속성을 설정하는 가장 좋은 방법 중 하나 생각

cell.textLabel.text = [NSString stringWithFormat:@"%@",[[_dataRows objectAtIndex:indexPath.row] valueForKey:kCountryName]]; 

cell.detailTextLabel.text = [NSString stringWithFormat:@"%@",[[_dataRows objectAtIndex:indexPath.row] valueForKey:kCountryCallingCode]]; 

의이 유용 할 수 있습니다 ..

+0

문제가 생겼습니다. 프로젝트가 IOS 4.3 버전이고 이유가 많아서 업그레이드 할 수 없으므로 ARC가 아닌 테이블 뷰 코드를 변경하는 방법을 알고 계십니까? – Elgert

+0

@Elgert 왜 비 호를 바꾸고 싶습니까? xcode 4.3 지원 호 .. – ilesh

+0

전체 프로젝트가 비 호이며 만약 내가 원호로 변환하면 100 + 오류 – Elgert