In my project i am filling the picker view array with the value which i am getting from the service.And in the same view i have another label on click of button in the label i want to get the same uipickerview with different value is that possible.....so wit开发者_如何学JAVAh one picker view my work will be done no need to call to different picker views...anyone has solution for this isssue
i dont think so .. it will only be possible if you load the data again which means the uipicker(all same instance) with loaded with same data
of course this is possible. Just switch to another model that holds the data that is used in the picker.
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
if (myCurrentEditingValue == MyCountryValue) {
return ...
}
else if (myCurrentEditingValue == MyCityValue) {
return ...
}
return nil;
}
- (IBAction)startEditingCountryField {
myCurrentEditingValue = MyCountryValue;
[picker reloadAllComponents];
}
You should get the idea.
精彩评论