Reputation: 1144
I am writing an application that uses a UIPickerView and populates its list items depending on previous selections by the user. I was reading this article and stumbled across his mention of "tags" and could not figure out how this was used. Can someone please give me a recommendation on the best way to accomplish this, and if this "tag" feature is it, just explain how it is used?
Thank you!
Upvotes: 0
Views: 254
Reputation: 13267
A tag is just a number that you associate with an object so that you can tell that object apart from others. So let's say you have multiple picker views. For the first picker view you can set a tag of 1
. For the second, set a tag of 2
, and so on.
In the app you're creating, since you have multiple picker views, you use tags to tell each picker view apart - if (pickerView.tag == 1) { //first picker view code here }
- set the correct number of cells for the picker view, and populate its cells with the correct list.
Upvotes: 2