반응형
UITextView에서 프로그래밍 방식으로 iOS8 Quicktype 키보드 비활성화
채팅 인터페이스가있는 iOS8 용 앱을 업데이트하려고하는데 새로운 Quicktype 키보드가 텍스트보기를 숨기므로 프로그래밍 방식으로 또는 인터페이스 빌더에서 해제하고 싶습니다.
어떻게 든 가능합니까 아니면 사용자 만 장치 설정에서 끌 수 있습니까?
으로이 문제를 해결하는 질문 / 답변이 있다는 것을 알고 UITextfield있지만 UITextView.
이 예제와 같이 4S와 같은 작은 화면에서 텍스트를 차단할 수있는 UITextView에 대한 키보드 제안 / 자동 완성 / QuickType을 비활성화 할 수 있습니다.
다음 줄로 :
myTextView.autocorrectionType = UITextAutocorrectionTypeNo;

또한 4S 타겟팅과 같은 특정 화면에서만이 작업을 수행하려면
if([[UIDevice currentDevice]userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
if (screenHeight == 568) {
// iphone 5 screen
}
else if (screenHeight < 568) {
// smaller than iphone 5 screen thus 4s
}
}
완전성을 위해 Interface Builder.
키보드 제안을 비활성화하려면 UITextField또는 UITextView—로 Attributes Inspector설정 Correction합니다 No.

다음 메서드를 사용하여 UITextView 범주 클래스를 만들었습니다.
- (void)disableQuickTypeBar:(BOOL)disable
{
self.autocorrectionType = disable ? UITextAutocorrectionTypeNo : UITextAutocorrectionTypeDefault;
if (self.isFirstResponder) {
[self resignFirstResponder];
[self becomeFirstResponder];
}
}
나는 더 깨끗한 접근이 있었으면 좋겠다. 또한 자동 수정 모드가라고 가정하며 Default모든 텍스트보기에 대해 항상 사실이 아닐 수 있습니다.
Swift 2 :
myUITextField.autocorrectionType = UITextAutocorrectionType.No
Swift 4.x에서 :
myUTTextField.autocorrectionType = .no
반응형
'Program Club' 카테고리의 다른 글
| grep에서 새 줄에 패턴을 제공하는 방법은 무엇입니까? (0) | 2020.11.06 |
|---|---|
| 사용자 'root'@ 'localhost'에 대한 액세스가 거부되었습니다 (비밀번호 사용 : YES)-권한이 없습니까? (0) | 2020.11.06 |
| RecyclerView의 빠른 스크롤 (0) | 2020.11.06 |
| 왜 std :: cout을 작성해야하고 std :: << (0) | 2020.11.05 |
| 목록 이해력 및 생성기 표현식에서 산출 (0) | 2020.11.05 |