0
레이블과 TextField가 포함 된 TabelViewCell로 펜촉을 만든 다음이 셀을 TableView에 두 행만로드합니다. 항목의 이름과 가격을 캡처하고 싶습니다. 따라서 indexPath.row 값에 액세스 할 수 있으므로 cellForRowAtIndexPath 메서드에서 각 레이블을 업데이트했습니다. 셀의 TextField에서 데이터 가져 오기
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleCellIdentifier = @"AddBudgetItemCell";
SCAddBudgetItemCell *cell = (SCAddBudgetItemCell *)[tableView dequeueReusableCellWithIdentifier:simpleCellIdentifier];
if(cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:simpleCellIdentifier owner:self options:nil];
cell = [nib objectAtIndex:0];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.dataTextField.delegate = self;
switch (indexPath.row)
{
case 0:
cell.titleLabel.text = @"Item";
break;
case 1:
cell.titleLabel.text = @"Price ¥";
break;
default:
break;
}
return cell;
}
그러나 나는 내가 만든 변수 "셀"나 IndexPath.row 값 중 하나에 액세스 할 수 없기 때문에 나는 텍스트 필드의에서 데이터를 검색 할 수있는 방법을 모르겠어요.