2016-07-15 4 views
0

도청 될 때 오른쪽으로 밀면 UISearchController 안에 UISearchBar가 있습니다.UISearchController의 UISearchBar가 도청 될 때 오른쪽으로 넘어집니다.

이 검색 창은 초기 설정 아래 Search before tapping

후 보이는 사용자가 누르는되면 내가있는 UIViewController

//Set self object to recieve all the updates of UISearchResultsController 
self.searchResultsUpdater = self; 


//Hide navigation bar during presentation of the UISearchController. 
self.hidesNavigationBarDuringPresentation = YES; 

//set delegates to UISearchBar and UISearchController 
self.delegate = self; 
self.searchBar.delegate = self; 

//Set scope bars that does not exist 
self.searchBar.scopeButtonTitles = [NSArray array]; 

//Some additional settings that can be configured 

self.context.definesPresentationContext = YES; 
self.dimsBackgroundDuringPresentation = NO; 

[self.searchBar sizeToFit]; 

self.tableView.tableHeaderView = self.searchBar; 

self.context.edgesForExtendedLayout = UIRectEdgeTop; 
self.searchBar.clipsToBounds = YES; 

내부 설정에 검색 창을 사용하는 코드 방법입니다 검색 창은 다음과 같이 작동합니다. After tapping the search bar it pushes to the right

다른 모든 컨트롤러가 정상적으로 작동합니다. 그것은 기묘한 방식으로 행동을 유지하는 단지 하나의 컨트롤러입니다.

응용 프로그램이 iPhone과 iPad를 모두 지원하므로 검색이 iPhone에서 제대로 작동하는 것 같지만 iPad에서는 이상하게 작동합니다.

답변

0

나는 스스로 문제를 해결할 수있었습니다. 내가 한 것은 :

self.definesPresentationContext = false; 

및보기가 기각되면 그것을 제거하는

self.searchController.active = false; 
관련 문제