2012-07-04 8 views
0

텍스트 필드 검색과 같은 기능을합니다. 내가 새로운 UISearchViewController 지금은 UISearchBarDisplayController가 키보드를 표시하지 않습니다.

- (void)textFieldDidBeginEditing:(UITextField *)textField 
{ 
     [textField resignFirstResponder]; 
    self.searchDisplayController.searchBar.hidden = FALSE; 
    [self.searchDisplayController.searchBar becomeFirstResponder]; 
    [self.searchDisplayController setActive:YES animated:NO]; 
} 

를 설정하지만 난 밖으로 키보드와 디스플레이 컨트롤러와 검은 색을 검색 할 경우에만 본

를 첫 번째 텍스트 필드를 만들고도 추가 보유하고있는

검색 막대를 직접 누르면 키보드가 표시됩니다.

UISearchBarControll에서 키보드를 표시하려면 어떻게해야합니까? 어 방법

편집 위에서

이 라인은 문제를 만들려고 여기 http://sourceforge.net/projects/locationdemo/files/LocationDemo.zip/download

답변

0

마지막으로 나는 답장을 모두

- (void)textFieldDidBeginEditing:(UITextField *)textField 
{ 
     [textField resignFirstResponder]; 
     NSTimer *theTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(keyboardWasShown:) userInfo:nil repeats:NO]; 
} 

- (void)keyboardWasShown:(NSNotification *)notification 
{ 
    [self.searchDisplayController.searchBar becomeFirstResponder]; 
    self.searchDisplayController.searchBar.hidden = FALSE; 
    CGSize keyboardSize = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size; 
    CGRect aRect = self.view.frame; 
    aRect.size.height -= keyboardSize.height; 
} 
0

에서 내 코드를 다운로드하십시오 :

[textField resignFirstResponder]; 

왜 거기입니다. 키보드를 보여주고 싶다면. 이 시점에서 이것을 부르면 안됩니다. 그러면 키보드가 닫히거나 숨겨 집니까?

그럼 [textField becomeFirstResponder]는 어디에서 호출합니까?

직접 작성하지 않고이 UISearchBar를 사용할 수도 있습니다.

+0

헤이 감사와 공유하려는 내 대답을 가지고 있지만 그것은 작동하지 있어요 .. – Hiren

+0

가 –

+0

위의 내 편집 내가 때문에 UISearchBar를 사용할 수 없습니다 – Hiren

관련 문제