禁用自动更正UITextView

1 objective-c autocorrect uitextview

有谁知道如何在uitextview中禁用自动更正编程?我有以下代码,但它不起作用.

- (void)_setUpTextView {
    self.textView = [[UITextView alloc] initWithFrame:self.bounds];
    self.textView.accessibilityLabel = @"CommentTextView";
    self.textView.translatesAutoresizingMaskIntoConstraints = NO;
    [self.textView setFont:[[AppearanceManager sharedManager] brightenFontWithSize:26.0f]];
    [self.textView.layer setCornerRadius:5.0f];
    self.textView.delegate = self;
    self.textView.autocorrectionType = FALSE; // or use  UITextAutocorrectionTypeNo
    self.textView.autocapitalizationType = UITextAutocapitalizationTypeNone;
    [self addSubview:self.textView];
}
Run Code Online (Sandbox Code Playgroud)

Hen*_*y F 6

哇,伙计,你评论了你自己的答案.进行此更改:

self.textView.autocorrectionType = UITextAutocorrectionTypeNo;
Run Code Online (Sandbox Code Playgroud)

你应该好好去.autoCorrectionType不会将布尔值作为参数.