2012-04-08 2 views
0

국가 목록과 해당 플래그가있는 사용자 지정 선택기를 사용할 수 있지만 나라를 선택하면 국가 이름과 플래그가 배경 그림으로 표시되어 원하는 이유를 모르겠습니다. 내 방법은 텍스트를 텍스트로 설정할 수 없습니다. 이것은 내 코드입니다. 내 "국가"NSSTring이 인터페이스에서 올바르게 선언되고 .m 으로 합성되고 namefieldText IBOutlet이 연결됩니다. 코드 :UIPicker는 텍스트 필드를 설정하지 않습니다

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component 
{ 
    // report the selection to the UI label 

    country = [customPickerArray objectAtIndex:[pickerView selectedRowInComponent:0]]; 

     nameFiled.text =country;  // Nothing happens here 

    NSLog(@"%@",country);   //NSLog show correctly selected country in a console 
} 

답변

1

문제는 당신의 것입니다 :

국가 = [customPickerArray objectAtIndex : [pickerView selectedRowInComponent : 0]]; 대신

, 당신은 말을해야합니다

국가 = [customPickerArray objectAtIndex : 행];

행운을 빌어 요!