我得到這個錯誤,當我用我剛纔實現搜索欄打。一些字母,而有些將與錯誤崩潰標題。錯誤似乎是在這裏,但我無法弄清楚什麼是錯的:「cell.textLabel.text = info.nric;」。終止應用程序由於未捕獲的異常「NSInvalidArgumentException」,原因是:「 - [NSCFString身份證]:
有人請幫助=(
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
if(searching){
PatientInfo *info = [copyListOfItems objectAtIndex:indexPath.row];
cell.textLabel.text = info.nric;
cell.detailTextLabel.text = [NSString stringWithFormat:@"%i, %i", info.category, info.age];
}
else {
//First get the dictionary object
NSDictionary *dictionary = [listOfItems objectAtIndex:indexPath.section];
NSArray *array = [dictionary objectForKey:@"Patients"];
PatientInfo *info = [array objectAtIndex:indexPath.row];
// NSString *cellValue = [array objectAtIndex:indexPath.row];
cell.textLabel.text = info.nric;
cell.detailTextLabel.text = [NSString stringWithFormat:@"%i, %i", info.category, info.age];
}
return cell;
}
你是如何填補'copyListOfItems'? – 2011-06-15 02:19:39