에서 null을 반환 : indexPathindexPath.row이있는 tableView didSelectRowAtIndexPath에 null를 돌려 indexPath.row있는 tableView didSelectRowAtIndexPath
내가이 선택 행을 돌려 줄 알았는데.
내가 그것을 (corectly) 반환 디버거에서 indexPath 보면 : "2 개 인덱스 [0, 0]"
내가 실종 무엇인가?에서 null을 반환 : indexPathindexPath.row이있는 tableView didSelectRowAtIndexPath에 null를 돌려 indexPath.row있는 tableView didSelectRowAtIndexPath
내가이 선택 행을 돌려 줄 알았는데.
내가 그것을 (corectly) 반환 디버거에서 indexPath 보면 : "2 개 인덱스 [0, 0]"
내가 실종 무엇인가?웰 은 입니다. row
속성은 유형 int
입니다. 실수로이를 개체 또는 포인터로 사용하고있는 것입니다.
실제로 선택한 "행"이 필요합니다. 어떻게 든 프로그래밍 현재 보이지 않는 행을 선택하면
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
참고,이 nil
를 반환 할 것입니다 : 당신이 선정되었습니다 세포 원하는 의미, 여기 방법입니다.
행 (또는 셀) 자체가 아닌 선택된 행으로 PATH를 리턴합니다.
indexPath (0,0)는 첫 번째 섹션의 첫 번째 셀입니다. 실행중인 테스트에 따라 이것이 올바른 결과 일 수 있습니다.
indexPath.section
은 무엇을 요구하는지 알려줍니다.
indexPath.row
은 해당 섹션의 어느 행이 필요한지 알려줍니다.
if (indexPath.section == 0) { // 1st section
if (indexPath.row == 0) return cell1;
if (indexPath.row == 1) return cell2;
if (indexPath.row == 2) return cell3;
} else if (indexPath.section == 1) { // 2nd section
if (indexPath.row == 0) return cell4;
if (indexPath.row == 1) return cell5;
if (indexPath.row == 2) return cell6;
}
return nil;
내가 잘못 배열 액세스 방법을 사용했다 :
두
당신은 이런 일을하고 싶지 0에서 시작 -S – mjmdavis