Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 初始化后如何更改UIPickerView中的行数_Ios_Objective C_Uipickerview - Fatal编程技术网

Ios 初始化后如何更改UIPickerView中的行数

Ios 初始化后如何更改UIPickerView中的行数,ios,objective-c,uipickerview,Ios,Objective C,Uipickerview,我有一个3组件UIPickerView,其中一个组件需要有不同数量的行,这取决于其他组件之一的当前值。如果我使用 - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component 它为其他组件的所有值设置行数。如何动态更改它?只需调用以下命令: [pickerView reloadAllComponents]; 您可以使用component参数来确定计数。这允许我选择

我有一个3组件UIPickerView,其中一个组件需要有不同数量的行,这取决于其他组件之一的当前值。如果我使用

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component

它为其他组件的所有值设置行数。如何动态更改它?

只需调用以下命令:

[pickerView reloadAllComponents];

您可以使用
component
参数来确定计数。这允许我选择要为其设置行数的组件。我需要为不同组件的每一行指定不同的行数,例如,如果组件0设置为行1,则组件1有20行;如果组件0设置为第2行,则组件1有15行,以此类推。因此,根据对其他组件的选择,返回给定组件的正确编号。