简体   繁体   中英

Multiple value to UIPicker View

I have a UI picker view to store child details, i got the value through a web service.I was added child name to picker view , now it shows all childs.

I also have one more value child id to store in the picker view, when a user select a child i need to get the id of the corresponding child.How i add multiple values to same row a pickerview.

Thanks, Companion

I got it you want to store its Id too then you have to use an object to handle this

int selectedRow = [childPicker selectedRowInComponent:0];
Child *childObj = [childsList objectAtIndex:selectedRow];

Here in childObject, You have stored this values. childObj.childName; childObj.childId;

您基本上可以使用带有两个组件的pickerView。根据组件将文本设置为picker标签

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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