0

I have a custom Picker with country list and corresponding flags everything work fine, but i want when country is selected country name and the flag as background picture to be displayed and i don't understand why my method can't set text a text it's make no sense for me. this is my code: Note my "country" NSSTring is properly declared in interface and synthesized in .m and namefieldText IBOutlet is connected. Code:

- (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 
}
Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
Alex
  • 81
  • 1
  • 7

1 Answers1

1

The issue is with your:

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

Instead, you should be saying:

country = [customPickerArray objectAtIndex:row];

Good luck!

ebandersen
  • 2,362
  • 26
  • 25