1、声明初始化一个用来装NSIndexPath的可变数组
2、将UITableViewCell里每一个IndexPath添加到数组中
3、在提交数据时,通过遍历拿到每一个IndexPath,再通过IndexPath获取到cell
for (int i=0; i<self.indexArr.count; i++) {
NSIndexPath *indexPath = self.indexArr[i];
PersonInfoCell *cell = [self.tableView cellForRowAtIndexPath:self.indexArr[i]];
if (indexPath.section==2) {
if (indexPath.row==1) {
//详细居住地址
if (!cell.valueTF.text.length) {
[DWAlertTool showToast:@"请输入当前详细居住地址"];
return NO;
}else{
self.detailAddress = cell.valueTF.text;
}
}else if(indexPath.row==2){
//工作单位
if (!cell.valueTF.text.length) {
[DWAlertTool showToast:@"请输入单位名称"];
return NO;
}else{
self.workName = cell.valueTF.text;
}
}
}
}