-2

pickerview containing 2 component both having same data when I select first component then the selected component should not appear in second component

Anurag Kabra
  • 444
  • 1
  • 5
  • 18
  • 1
    Please put a little more effort into your post, as it stands right now I have no idea what is wrong with your code and no idea how to help you. – Mick MacCallum Sep 07 '12 at 09:03
  • Welcome to Stack Overflow. To help us answer your question, please add some code showing us what you've tried already. This will help you get succinct, quick and relevant answers. – James Webster Sep 22 '12 at 08:18

3 Answers3

1

After you make a selection in the first component, remove the item from the datasource for the second component & reload the picker components. HTH.

batman
  • 1,937
  • 2
  • 22
  • 41
0

Your question is not clear but on the basic of what i understood:

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
 string = [fistPickerArray objectAtIndex:row];
//do what ever logic you want 
   for(NSString str in secondArray)
   {
    if([string isEqualToString:str])
    {
      [secondPickerArray removeObject:str],
    }
  }
   [picker reloadAllComponent];

}
V-Xtreme
  • 7,230
  • 9
  • 39
  • 79
0

write below code in didSelectRow method

if(component == 0) {

string = [yourarray objectAtIndex:row];

}

then in titleForRow method,

    if(component == 1) { if([string isEqualToString:[yourarray objectAtIndex:row]]) { break; return nil; else{ return string; }

    }

}
V-Xtreme
  • 7,230
  • 9
  • 39
  • 79
nick
  • 1
  • There are a couple of errors here. If you break up the second snippet on to separate lines with a more legible indentation, I think the issues will be self evident. – Rob Oct 04 '12 at 19:47