If statement Based on a selected row in a UIPickerView

时间:2017-12-18 08:01:12

标签: arrays swift uipickerview

So i have an input page for the user to input a list of data. eg Paddock names (back Paddock, Front Paddock, etc) This then is stored for later use.

I then have a picker view on another page that displays this list of names. What i want is an if statement that when the user selects the first name in the list it will do (this...) else if the user selects the second name in the list it will do (this instead...) and so on for each name.

The problem I'm having is i don't know what the user is going input as the name of his paddock. so i can't say ,

this.httpClient.get('../api/path', { 
  params: Object.entries(queryParameterObject).reduce((queryParams, [key, value]) => queryParams.set(key, value), new HttpParams());
});

Any ideas would be appreciated P.S I'm using Swift 3

1 个答案:

答案 0 :(得分:0)

You should use the Property or method "LoggedIn" is not defined on the instance but referenced during render to be able to respond to user selection. It has a method called UIPickerViewDelegate which gets called by the picker view when the selection changes. This is the appropriate place to implement your logic. Please see the docs for further instructions.