My app collects various types of information and sends it off to our server. Some of the questions are of fixed type so I need to use Pickers. When I've used pickers before they are initialised when the app starts with the array of selections. I had thought I would use different pickers through various subViews. Would it be better to use just one Picker and then reset the array used dynamically. If so how do I do this?
我的应用程序收集各种类型的信息并将其发送到我们的服务器。有些问题是固定类型的,所以我需要使用Pickers。当我在应用程序以选择数组开始时初始化之前我使用了选择器。我以为我会通过各种子视图使用不同的选择器。最好只使用一个Picker,然后重置动态使用的数组。如果是这样,我该怎么做?
2 个解决方案
#1
1
Note that each method of both the datasource and the delegate protocols contain a UIPickerView * parameter, for instance:
请注意,数据源和委托协议的每个方法都包含UIPickerView *参数,例如:
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
You need to use it to distinguish between your two instances, as follows:
您需要使用它来区分您的两个实例,如下所示:
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
if([pickerView isEqual: pickerOne]{
// return the appropriate number of components, for instance
return 3;
}
if([pickerView isEqual: pickerTwo]{
// return the appropriate number of components, for instance
return 4;
}
}
#2
0
Give the two different tags. And compare tag for loading your array.
给出两个不同的标签。并比较用于加载数组的标记。
#1
1
Note that each method of both the datasource and the delegate protocols contain a UIPickerView * parameter, for instance:
请注意,数据源和委托协议的每个方法都包含UIPickerView *参数,例如:
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
You need to use it to distinguish between your two instances, as follows:
您需要使用它来区分您的两个实例,如下所示:
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
if([pickerView isEqual: pickerOne]{
// return the appropriate number of components, for instance
return 3;
}
if([pickerView isEqual: pickerTwo]{
// return the appropriate number of components, for instance
return 4;
}
}
#2
0
Give the two different tags. And compare tag for loading your array.
给出两个不同的标签。并比较用于加载数组的标记。