如何从 objective c 中的 UITableViewCell 获取 2 个输入值

How to take 2 input value from a UITableViewCell in objective c

我需要从相同的 UITableViewCell 中获取 2 个输入值,例如文本字段 1 和文本字段 2 [分数 1,分数 2],并将这些值添加到字典中,并将这些字典数据添加到 NSMutableArray.

我用文本字段委托方法尝试了下面的代码..

- (void)textFieldDidEndEditing:(UITextField *)textField{
UITableViewCell *cell = (UITableViewCell*) textField.superview.superview;
NSIndexPath *txtIndPath = [tblMonthlyPerformanceReport indexPathForCell:cell];
MonthlyPerformanceQuestions * question;
if (txtIndPath.section==0)
{
    question = [[HSEAppData appData].arrayMonthlyGeneralQustion objectAtIndex:txtIndPath.row];

}
if (txtIndPath.section==1)
{
    question = [[HSEAppData appData].arrayMonthlyLeadQustion objectAtIndex:txtIndPath.row];

} if (txtIndPath.section==2)
{
    question = [[HSEAppData appData].arrayMonthlyLagQustion objectAtIndex:txtIndPath.row];

}

NSLog(@"%@ , %@",question.QuestionId, question.Question);

NSMutableDictionary *userDictionary=[[NSMutableDictionary alloc]init];

[userDictionary setObject:question.QuestionId forKey:@"question"];
if (textField.tag==10001)
{
    [userDictionary setObject:textField.text forKey:@"score1"];
}
if (textField.tag==10002)
{
[userDictionary setObject:textField.text forKey:@"score2"];

}

[scoreMutableArray addObject:userDictionary];

我收到回复了

{
question = a5k0k0000004kxsAAA;
score2 = 5;
}

我将数据放在分数 1 上,但数据放在分数 2 上 我需要这样的字典数据

{
                "question": "a5k0k0000004kxnAAA", 
                "score1": "20", 
                "score2": "20"
            }

请帮帮我

将Dictionary作为全局变量。将每个值添加到字典中,然后在将字典添加到数组时检查字典的计数,如果它是 3,则将字典添加到数组,添加后使字典为空。