Search code examples
uiviewuitextfielduipickerview

Finding uitextfields by tag


I have multiple textfields on my view, and each time a textfield is taped a picker appears(the picker was made by code). This works fine for the first textfield, I can also select a row and the textfield receives it. But when I tap the second one and the picker appears, the row selected appears on the first textfield. I know I can use "tag" to distinguish them, but then I get stuck...it doesn´t work.

Does anyone have/has this problem? What method do I have to change?


Solution

  • try creating one picker for each textfield pick1,pick2.......then in the

    - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
    

    method u check

    if( pickerview==pick1)
    {
    text1.text=  (pick1 value at row);
    }
    else if(pickerview==pick2)
    {
    text2.text= (pick2 value at row);
    }