달성하고자하는 것은 위로 이동하여 UINavBar를 덮고 오른쪽에 취소 버튼을 포함하는 UISearchBar입니다. 예상대로UITableView가 UISearchBar로 스크롤되지 않음
searchDC = [[[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self] autorelease];
은 어떤 일이 끝나는 것은 jQuery과 그냥 스크롤하지 않습니다, 그러나 모든 다른 기능 : 나는 코드의 다음 줄을 사용할 때까지 모두 잘 간다. 해당 행을 제거하면 내비게이션 막대가 표시되고 검색 막대는 바로 아래에 있으며 취소 버튼도 없습니다.
아이디어가 있으십니까?
검색 창을 그리기위한 코드는 다음과 같습니다
self.navigationItem.title = @"Search";
searchBar = [[[UISearchBar alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.view.bounds.size.width, 44.0f)] autorelease];
searchBar.autocorrectionType = UITextAutocorrectionTypeNo;
searchBar.autocapitalizationType = UITextAutocapitalizationTypeNone;
searchBar.keyboardType = UIKeyboardTypeAlphabet;
searchBar.delegate = self;
[searchBar becomeFirstResponder];
tableView.tableHeaderView = searchBar;
tableView.tableHeaderView.frame = CGRectMake(0.f, 0.f, 480.f, 44.f);
searchDC = [[[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self] autorelease];
searchDC.searchResultsDataSource = self;
searchDC.searchResultsDelegate = self;
searchDC.searchResultsTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
searchDC.searchResultsTableView.scrollEnabled = YES;
overlayView.frame = CGRectMake(0, 50, 320, 480);
[self.view addSubview:overlayView];
[self.view bringSubviewToFront:overlayView];
죄송합니다. 원래 게시물을 수정했습니다. –