得到UIPickerView值我有我的UITableViewController如何在UITableView的
- (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;
}
的每行一個UIPickerView和我有didSelectRow爲選擇器
- (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);
}
但我得到的路徑vaue爲空值。 如何在UITableView中獲取UIPickerView值。我需要每行的選擇器值。
你想要什麼,爲什麼你創建的每個細胞UIPickerView和NSMutableArray裏? –
我在此表中列出購物車。我想更新購物車中產品的數量(或顏色)。 – Vinod