2014-01-10 3 views
0

ios7에서 작업 중입니다. 내 응용 프로그램에서 나는 UITableView 및 UISearchBar 컨트롤러가 있습니다. 인한 다음과 같은 이유로에게 UISearchBar 컨트롤러 내 응용 프로그램이 충돌 을 구현하면서 '식별자 listcell 요소와 셀 큐에서 제거 할 수없는 - 펜촉 또는를위한 클래스를 등록해야합니다 : 인해 캐치되지 않는 예외'NSInternalInconsistencyException '응용 프로그램 종료, 이유는UIsearchBarController가있는 ios7에서 충돌이 발생합니까?

식별자 또는 스토리 보드의 프로토 타입 셀 연결 '

사용자 지정 UITabelViewCell.UISearchBarController 대리자 메서드를 사용하고 있습니다. 대리자 메서드도 구현됩니다.

어느 누구도 나에게 더 나은 링크 또는 해결책을 제공 할 수 있습니까?

다음

내 코드입니다 :

// ---------------------- 검색 부분에 대한 코드 --------- ---------

-(void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope 
{ 
NSPredicate *resultPredicate = [NSPredicate predicateWithFormat:@"SELF Contains[cd] %@",searchText]; 

    searchResults = [_detailList filteredArrayUsingPredicate:resultPredicate]; 
} 


-(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString 
{ 
    [self filterContentForSearchText:searchString scope:[[self.searchDisplayController.searchBar scopeButtonTitles]objectAtIndex:[self.searchDisplayController.searchBar selectedScopeButtonIndex]]]; 
    return YES; 
} 



-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{ 
    return 1; 
} 

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 
    if (tableView == self.searchDisplayController.searchResultsTableView) 
    { 
     return [searchResults count]; 
    } 
    else 
    return _detailList.count; 
} 


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"listcell"; 
// 
    ListCell *listcell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 


     listcell.lbl_detail.text = _detailList [indexPath.row]; 
    listcell.lbl_Address.text = _detailList1 [indexPath.row]; 
    listcell.lbl_link.text = _detailList2 [indexPath.row]; 
    listcell.lbl_number.text = _detailList3 [indexPath.row]; 


    return listcell; 

} 


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{  
[(ContainerViewController *)self.parentViewController addDetailViewController]; 
} 

감사

+0

스토리 보드에 "listcell"식별자를 설정해야합니다. –

+0

이 문제로 나를 도와 줄 수 있습니다 –

+0

스토리 보드에 해당 식별자를 설정했습니다 –

답변

0

당신은 방법의 viewDidLoad에 다음 줄을 추가해야합니다

[self.searchDisplayController.searchBar있는 registerClass : [listcell 요소 클래스] forCellReuseIdentifier : @ "listcell"];

관련 문제