사용자 지정 UITableViewCell이 있는데 여기에 UIPickerView가 있습니다. 이를 관리하기 위해 UIPickerView 대리자 및 데이터 소스 메서드를 구현 한 Subclass를 만들었습니다. cellForRowAtIndexPath 내가 이런 식으로 구현되는 경우 : 서브 클래스하는 .m 파일에사용자 지정 UITableViewCell 내의 UIPickerView
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section==2) {
PickerCellTableViewCell *cell2=[tableView dequeueReusableCellWithIdentifier:@"pickerCell" forIndexPath:indexPath];
cell2.cellPickerInputArray=self.pickerArray;
return cell2;
}else{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"normalCell" forIndexPath:indexPath];
cell.textLabel.text=[[self.inputArray objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
return cell;
}
}
나는 다음과 같은 한 :
는-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
return [self.cellPickerInputArray count];
}
나는 다음과 같은 문제가있다 :이처럼두면 충돌과 콘솔이 나에게주는이 :
은잘못된 갱신 : 섹션 0의 행 개수가 잘못 업데이트 후 기존 섹션에 포함 된 행의 수 (7),691,363를해야합니다 (0이 삽입되고 0이 삭제됨) 에서 삽입 또는 삭제 된 행 수를 더하거나 뺀 수 및 더하기 또는 빼기 수 행 수를 더한 것보다 앞의 해당 섹션에 포함 된 행 수와 같습니다. (0은 안으로 움직이고 0은 밖으로 움직였다). " 나는 numberOfRowsInComponent 변경하는 경우
그러나 (이 예에서는 7) 실제 행 수를 반환하기를, 모든 것을 꽤 잘 작동합니다.
나는 해봤지만 문제/해결책을 찾지 못했다. 어떤 도움을 주시면 감사하겠습니다. 미리 감사드립니다!
편집! @meda에 의해 NSLoged NSLog(@"PickerInputArray count"%@",[self.cellPickerInputArray
카운트]에 의해 sugested); 방법 pickerView numberOfRowsInComponent 다음
내부 : 당신의 로그에서
2014-03-30 21:04:54.756 TestPickerOnTable[3498:60b] PickerInputArray count0
2014-03-30 21:04:54.757 TestPickerOnTable[3498:60b] PickerInputArray count0
2014-03-30 21:04:54.758 TestPickerOnTable[3498:60b] PickerInputArray count0
2014-03-30 21:04:54.758 TestPickerOnTable[3498:60b] PickerInputArray count0
2014-03-30 21:04:54.762 TestPickerOnTable[3498:60b] PickerInputArray count7
2014-03-30 21:04:54.765 TestPickerOnTable[3498:60b] PickerInputArray count7
2014-03-30 21:04:54.767 TestPickerOnTable[3498:60b] PickerInputArray count7
2014-03-30 21:04:54.770 TestPickerOnTable[3498:60b] PickerInputArray count7
2014-03-30 21:04:54.771 TestPickerOnTable[3498:60b] PickerInputArray count7
2014-03-30 21:04:54.771 TestPickerOnTable[3498:60b] PickerInputArray count7
는'NSLog (%의 @ ", [self.cellPickerInputArray 수를]"PickerInputArray 카운트 "@) 로그, 그렇지 않은 경우' 7과 같으면 whyt를 찾아야합니다 – meda
그래, 이미 시도했습니다. 위의 편집을 참조하십시오. – Marcal