2009-07-22 2 views

답변

11

을 그것은 직접 액세스 할 수 없습니다. 난 당신이 가능성이 응용 프로그램을 깨고, 어떤 시점에서 변경하는 것 이상이다 searchResultsTableView의 내부 동작에 의존하고 있기 때문에이 권하고 싶지 않다

UITableView *tableView = self.searchDisplayController.searchResultsTableView; 
for(UIView *subview in tableView.subviews) { 
    if([subview class] == [UILabel class]) { 
     UILabel *lbl = (UILabel*)subview; // sv changed to subview. 
     lbl.text = @"My custom string"; 
    } 
} 

: 여기에 하나의 예입니다. Apple과 함께 버그/기능 요청을 여는 것은 좋은 방법입니다.

+0

멋지다, 고마워 ... – Stefan

+0

하지만 언제 조정해야합니까? 이'UILabel'은'subviews'에서 실제로 나타난 후에 만 ​​나타납니다 ... –

+0

예,이 코드를 어디에 넣을까요 ??? – Napolux

14

빈 결과 집합을 사용하지 않아도 레이블을 성공적으로 제거했습니다.

서버에서 가져온 결과가 없으면 데이터 소스를 단일 행으로 재설정하고 빈 테이블보기 셀을 표시하십시오.

- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    NSString *listItem = [self.filteredListContent objectAtIndex:indexPath.row]; 
    if ([listItem isEqualToString:@""]) { 
     return nil; 
    } 
    return indexPath; 
} 
:

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    NSString *listItem = [self.filteredListContent objectAtIndex:indexPath.row]; 
    if ([listItem isEqualToString:@""]) { 
     cell.selectionStyle = UITableViewCellSelectionStyleNone; 
    } 
} 

나는 또한 willSelect 대리자 메서드에 "더미"세포 논리를 추가하는 것이 필요 발견했습니다

또한, 사용 로직은 "더미"셀을 선택합니다 refeuse합니다