kschaeffler
kschaeffler

Reputation: 4213

Toggle iOS 8 predictive text while typing

When you enable autocorrectionType = UITextAutocorrectionTypeYes in a texfield. In iOS 8 you have this predictive text activated.

I would like to be able to toggle the predictive inputView while typing.

if (condition) { 
    self.textField.autocorrectionType = UITextAutocorrectionTypeYes; 
} else {
    self.textField.autocorrectionType = UITextAutocorrectionTypeNo; 
}

[self.textField reloadInputViews];

My keyboard is black transparent. And this hides the predictive input view behind the keyboard.

enter image description here

I would like to know if it's possible to hide it totally.

Upvotes: 0

Views: 1783

Answers (1)

irmco
irmco

Reputation: 924

As of now (Xcode 6.0.1) there is no documented feature to enable/disable predictive bar on the go. But there is a way to toggle it programmatically. I also tried some other methods (eg. setNeedsLayout on input view) but this is the only one that works.

[textfield resignFirstResponder];
[textfield becomeFirstResponder];

It even works in an animation block but awful animations, don't use it :]

Upvotes: 1

Related Questions