iOS 4.x의 버그가 아닐 수도 있습니다. iOS 9.x에서도 버그가있을 수 있습니다./일본어 중국어 또는 키보드 위의 단어의 제안 된 목록에서 단어를 선택할 수있는 다른 언어에 대한
이 대리자 메서드
- (BOOL) textField : (UITextField *) textField shouldChangeCharactersInRange : (NSRange) range replacementString : (NSString *) string
이의 UITextField의 called.The 텍스트가 choosed 할 단어가 추가됩니다되지 않을 것이다 직접.
해결 방법은 UITextFieldTextDidChangeNotification
을 사용하는 것입니다
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(checkForTextfield:)
name:UITextFieldTextDidChangeNotification
object:nil];
영향을받는 텍스트 필드는 통지의 대상 매개 변수에 저장됩니다. userInfo 사전은 사용되지 않습니다.
- (void)checkForTextfield:(NSNotification *)noti{
UITextField* textField = noti.object;
//do whatever you want with the UITextfield
}
및 할당 해제 때 NSNotificationCenter
에서 자신을 제거하는 것을 잊지 마세요 :
- (void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
그것은 아이폰 OS의 버그처럼 들린다. 사용중인 iOS 버전은 무엇입니까? 이 델리게이트는 영어를 입력 할 때 호출됩니다. – xuzhe
이 시뮬레이터는 아마도 4.3 일 것입니다. 이 대리자는 영어 일 때 호출됩니다. iPad와 마찬가지로 추천 목록에서 단어를 선택하면 해당 단어가 표시되지 않습니다. – rae148