Patient
我的主页中有一个对象列表,这是一个表格视图。当我单击其中一行时,它将转到另一个页面,其中显示与该特定患者有关的两个选项,选项 1 是“患者信息”,选项 2 是所选特定患者的所有入院日期的列表。
我在使用第二个选项时遇到了一些问题——当我返回主页并选择另一位患者时,入院日期表似乎没有刷新。入院日期表始终显示我选择的第一位患者的入院日期。我真的不知道哪里错了。
我使用该viewWillAppear
方法是因为viewDidLoad
似乎只被调用一次;我证明了使用NSLog(_nric);
-- 它只打印一次。我怀疑这是给我问题的表格视图方法。有人可以就下面的第二种方法给我一些建议吗?
- (void)viewWillAppear:(BOOL)animated {
_listOfPatientsAdmInfoOptions = [[NSMutableArray alloc] init];
for(PatientAdmInfo *patientAdmInfo1 in [[PatientDatabase database] patientAdminList:_nric]){
[ _listOfPatientsAdmInfoOptions addObject:patientAdmInfo1];
NSLog(_nric);
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
_patientAdmInfo = [[PatientAdmInfo alloc] init ];
_patientAdmInfo = [_listOfPatientsAdmInfoOptions objectAtIndex:indexPath.row];
cell.textLabel.text = _patientAdmInfo.pDiagnosis;
//cell.detailTextLabel.text = patientAdmInfo.pDiagnosis, patientAdmInfo.sDiagnosis;
return cell;
}