테이블 뷰의 검색 막대를 추가해야합니다. "환자"라는 개체 내부에 실제로 저장된 "이름"이 있습니다. "환자"개체의 배열이 있습니다. 검색 막대를 설정하여 이름을 검색하십시오. 그러나 NSPredicate를 사용하여 이름을 검색하는 방법은 무엇입니까?테이블 뷰 검색 막대
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString* CellId= @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellId];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellId] ;
}
cell.accessoryType = UITableViewCellAccessoryNone;
ObjPatient = [allPatientDetails objectAtIndex:indexPath.row];
cell.textLabel.text =[NSString stringWithFormat:@"%@ %@",ObjPatient.firstName,ObjPatient.lastName];
return cell;
}
위의 표에있는 이름을 표시하는 코드입니다. 모든 제안을 환영합니다, 감사합니다
http://www.appcoda.com/how-to-add-search-bar-uitableview/ –
감사합니다. 문제는 NSPredicate를 사용하여 object의 속성 인 "name"을 만드는 방법입니다. 이러한 객체의 배열이 있습니다. –