I have a UIPickerView on each row of my UITableViewController
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CartCell *cell = (CartCell *)[tableView dequeueReusableCellWithIdentifier:@"CartCell"];
Cart *cart = (self.carts)[indexPath.row];
cell.productnameLabel.text = cart.productname;
cell.priceLabel.text = cart.price;
picker = [[UIPickerView alloc]initWithFrame:CGRectMake(70, 0, 100, 40)];
[picker setDelegate:self];
arrayColors = [[NSMutableArray alloc] init];
[arrayColors addObject:@"Red"];
[arrayColors addObject:@"Orange"];
[arrayColors addObject:@"Yellow"];
[arrayColors addObject:@"Green"];
[arrayColors addObject:@"Blue"];
[arrayColors addObject:@"Indigo"];
[arrayColors addObject:@"Violet"];
[cell addSubview:picker];
return cell;
}
and I have the didSelectRow for the picker
- (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
NSLog(@"Selected Color: %@. Index of selected color: %i", [arrayColors objectAtIndex:row], row);
NSIndexPath *path = [self.tableView indexPathForSelectedRow];
NSLog(@"indexPathForSelectedRow %@", path);
}
But I am getting the path vaue as null. How to get UIPickerView value in UITableView. I need the picker value of each row.