UINavigationController를 사용하여 UISearchBar 및 UISearchDisplayController를 추가했습니다. navigationBar에 몇 개의 버튼이 필요했기 때문에 버튼 몇 개를 포함하는 사용자 정의보기를 작성하여 rightBarButtonItem으로 지정했습니다. 검색 막대를 클릭하면 키보드가 맨 아래에서 팝업되고 UINavigationController의 navigationBar가 화면 밖으로 이동합니다. 이제는 UISearchBar에 입력 한 내용을 볼 수 없습니다. 이 문제를 해결할 방법이 있습니까? 나는 그들이 UINavigationBar + navigationBar의 LHS 또는 RHS에있는 여러 개의 버튼을 사용하는 것처럼 보이는 다른 응용 프로그램을 보았습니다. 그래서 이것이 가능하다고 가정합니다. 감사.UINavigationController가있는 UISearchBar
UIButton *homeButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
UIImage *house = [UIImage imageNamed:@"icon_house.png"];
[homeButton setImage:house forState:UIControlStateNormal];
[homeButton addTarget:self action:@selector(homePressed:) forControlEvents:UIControlEventTouchUpInside];
UIButton *filterButton = [[UIButton alloc] initWithFrame:CGRectMake(49, 0, 44, 44)];
[filterButton setTitle:@"Filter" forState:UIControlStateNormal];
[filterButton addTarget:self action:@selector(FilterButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
self.SearchEntry = [[[UISearchBar alloc] initWithFrame:CGRectMake(98, 0, 150, 44)] autorelease];
self.SearchEntry.delegate = self;
UISearchDisplayController *searchDisplayCtlr = [[UISearchDisplayController alloc] initWithSearchBar:_searchEntry contentsController:self];
searchDisplayCtlr.searchResultsDataSource = self;
searchDisplayCtlr.searchResultsDelegate = self;
searchDisplayCtlr.delegate = self;
UIView *containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 248, 44)];
[containerView addSubview:homeButton];
[containerView addSubview:filterButton];
[containerView addSubview:_searchEntry];