Matze
Matze

Reputation: 23

How can i Identify different pickerViews?

My pickerViews all come from one pickerViewCell. I generate 5 of them and I need to know how i can identify all these 5 at the same time and get the indexPath.row from all of them.

Upvotes: 2

Views: 181

Answers (3)

Bharath Vankireddy
Bharath Vankireddy

Reputation: 932

Initially set tagvalue to each picker view. When you scroll cells of pickerview, delegate method of picker view shown below called all the time. By using tag value find which picker view is selected.

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
 if(pickerView.tag == 0) {

 } else if(pickerView.tag == 1) {

 } else if(pickerView.tag == 2) {

 }
}

Upvotes: 0

Akshay Patel
Akshay Patel

Reputation: 157

set pickerview tag as indexpath.row and identify pickerview.

Upvotes: 1

Ramy Kfoury
Ramy Kfoury

Reputation: 947

you can set the tag property of each pickerView which is an integer that you can use to identify each

Upvotes: 3

Related Questions