0

두 개의 UITableViewController가 있는데, 먼저 테이블 뷰 데이터를 표시하고 두 번째 테이블은 필터링 된 검색을 처리합니다.didSelectRow 다음에 UISearchController를 닫는 방법?

내가 가진 문제는 두 번째 UITableViewController에서 셀을 탭하여 다른 컨트롤러에 연결하면 UISearchBar와 키보드가 맨 위에있는 결과를 필터링 한 것입니다.

첫 번째 TableViewController에서 발생하지 않습니다.

Heres 내 스토리 보드, 오른쪽 하단 TableViewController는 필터링 된 결과를 처리합니다. 코드가 도움이 될 수 아래

enter image description here

답변

0

가 될 수있다 : 그것은 내가 SEGUE 시각적으로 한 번 모습을 Heres

enter image description here

같은 검색 창 위임 방법에

Dissmiss 키보드,

- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar { 
    [searchBar resignFirstResponder]; 
} 

OR 코드 아래 DidSelectRow 방법 쓰기에

:

[searchBar resignFirstResponder]; 

당신은 또한 DidSelectRow 방법에 [self.view endEditing:YES] 쓸 수 있습니다.

편집 : DidSelectRow 방법 코드 아래

또는

쓰기 :

[[(AppDelegate *)[[UIApplication sharedApplication] delegate] window] endEditing:YES]; 
+0

한가지는, 컨트롤러에서 검색 창에 대한 더 콘센트 프로그래머 없습니다. 다음은 UISearchController를 만드는 데 사용 된 링크입니다. http://www.jhof.me/simple-uisearchcontroller-implementation/ – farhan

+0

시도, [self.view endEditing : YES] DidSelectRow 메서드에서 대답 @ farhan에 언급 된대로 –

+0

여전히 거기에 있습니다. . – farhan