내 viewController에 여러 UIPickerView가 있습니다.여러 UIPickerView
그리고이 중 하나는 2 개의 UILabels를 1 개의 피커 행에 표시하므로 사용자 정의해야합니다.
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row
forComponent:(NSInteger)component {
// this method is use for normal pickers, and I would judge whether the picker that calling
// this method is a normal one or the special one by pickerView.
}
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row
forComponent:(NSInteger)component reusingView:(UIView *)view {
// and this one is specially for the special picker, I would also judge the pickerView is
//normal or special, if pickerView is normal, return nil, else I return a UIView with
//2 UIlabels.
}
하지만 지금 내 디버깅 후, 내가 함께이 방법을 구현하는 경우, 두 번째는 항상 전화를 첫 번째는 호출 할 수 결코 보인다 발견 :
는 그리고 나는이 위임 방법을 사용
그리고 내 특수 피커가 올바른 데이터를 표시하지만 다른 것들은 아무 것도 없습니다.
어떻게하면됩니까?
두 번째 방법에서 모든 선택기 데이터를 제공하면 특수 선택기의 reusingView가 다른 선택기와 같은 형식이 아니기 때문에 reusingView가 문제가됩니까?
고맙습니다.
흥미로운 점은 두 번째 방법에서 다른 선택기에 대해 nil을 반환합니까? – govi
네, 문제가 되겠습니까? 내가 아무것도 돌려주지 않으면 경고가 생기므로 ... 나는 그 코드를 즉시 삭제하려고 노력할 것이다. –
잘하고 있습니다. 그 줄을 삭제할 필요는 없습니다. – govi