简体   繁体   English

iphone的UIPickerView

[英]UIPickerView for Iphone

I am creating a unit convertor app using a pickerview with three components and a plist..first one is category component and second and third are unit components.我正在使用带有三个组件和一个 plist 的 pickerview 创建一个单位转换器应用程序。第一个是类别组件,第二个和第三个是单位组件。 What i need is when i click an item in category component the remaining two components should get the units regarding that particular category.我需要的是当我单击类别组件中的一个项目时,其余两个组件应该获得有关该特定类别的单位。 Can some one help me on this?有人可以帮助我吗?

this is for selecting the same row in each component这是用于在每个组件中选择同一行

here i did with first component do like that for ur logic在这里,我使用第一个组件对您的逻辑进行了类似操作

so change this method and u have to implement UIPickerViewDelegate所以改变这个方法,你必须实现 UIPickerViewDelegate

 - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{

            if (component == 1) {

                [pickerView selectRow:row inComponent:1 animated:YES];

                [pickerView selectRow:row inComponent:2 animated:YES];


            }


        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM