【问题标题】:Disable autocorrect UITextView禁用自动更正 UITextView
【发布时间】:2015-04-17 02:23:20
【问题描述】:

有谁知道如何在 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];
}

【问题讨论】:

  • FALSE 不是autocorrectionType。为什么要评论UITextAutocorrectionTypeNo
  • 那是我的错误。谢谢!我正在使用别人代码中的代码片段,这对我来说非常愚蠢。

标签: objective-c uitextview autocorrect


【解决方案1】:

哇,伙计,您注释掉了自己的答案。进行此更改:

self.textView.autocorrectionType = UITextAutocorrectionTypeNo;

你应该很高兴。 autoCorrectionType 不接受布尔值作为参数。

【讨论】:

    猜你喜欢
    • 2016-04-03
    • 1970-01-01
    • 1970-01-01
    • 2012-11-20
    • 1970-01-01
    • 2012-05-07
    • 1970-01-01
    • 2014-05-24
    相关资源
    最近更新 更多