2011-10-17 3 views

답변

1

등록 키보드 알림 :

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow) name:UIKeyboardWillShowNotification object:nil]; 

을 그리고 당신은 keyboardWillShow에 다음 코드를 배치하여 게재를 중지 할 수 있습니다 :이 결함없이 확실하지 100 %

UITextField *dummyTextField = etc. 
//Basically, create a dummy uitextfield that you never show. 
//I can't remember all the syntax :) 


[dummyTextField becomeFirstResponder]; 
[dummyTextField resignFirstResponder]; 
//Keyboard should be gone. Hoorah! 

작동하는 경우를 . 키보드가 다음 애니메이션을 시작 자체를 다시 숨기는 경우 좋아하지 않는 키보드를 사임되는 경우가 대신 몇 가지 더미의 UIView에 더미에 textField의 inputView 속성을 변경하려고 할 수 후 보여주는 것 동안, 당신은

[UIView enableAnimations:NO]; 

를 사용할 수 있습니다 .

잘하면이 어딘가에 있어야합니다!

+0

건배 해보겠습니다. – user281300

+0

더미 텍스트 필드와 UIView를 시도했지만 작동하지 않습니다 (iOS9). 나에게 맞는 것은 webView.endEditing (true)을 호출하는 것이다. http://stackoverflow.com/questions/9108877/dimiss-keyboard-when-editing-textfield-on-uiwebview를 참조하십시오. – endavid

관련 문제