Disable autocorrect UITextView

别等时光非礼了梦想. 提交于 2019-12-02 11:39:14

问题


Does anyone know how to disable autocorrect programming in uitextview? I have the following code, but it doesn't work.

- (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];
}

回答1:


Whoa there buddy, you commented out your own answer. Make this change:

self.textView.autocorrectionType = UITextAutocorrectionTypeNo;

And you should be good to go. autoCorrectionType does not take a boolean as an argument.



来源:https://stackoverflow.com/questions/29689173/disable-autocorrect-uitextview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!