Independent Double picker
I have double picker one picker for开发者_Python百科 suit (heart, diamond etc) of a card and the other the value of the card (king, ten, two etc). What I want to know how do I eliminate a value from the card picker once it was already selected so it cant be chosen again?
Keep your UIPickerView's data stored in an NSMutableArray
. Then, when the user makes his choices, remove those objects from the data source array, and call
[self.myPickerView reloadAllComponents];
This will only work, of course, if you're not hardcoding the value for numberOfRowsInComponent:
, but doing something like
- (NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component {
return [dataArray count];
}
精彩评论