I'm using in my app a textview with blue colored background.
When autocorrect is enabled, whenever it corrects a word a white box forms around the word and the text's color changes also.
Any ideas on how to stop this effect?
Nope, I think you can't change the color of the overlay or the textcolor out of the box..
This is a hard one, if you put a breakpoint in - (void) layoutSubviews {..}
of your view you'll see UIKit has drawn a 'UITextSelectionView' above the text...
I tried to subclass UITextView to see if its layoutSubviews get's fired and it seems it does!
So I tried to remove the overlay:
- (void) layoutSubviews {
[super layoutSubviews];
for (UIView *subview in self.subviews) {
if ([NSStringFromClass([subview class]) isEqualToString:@"UITextSelectionView"]) {
DLog(@"Subview %@", [subview debugDescription]);
[subview removeFromSuperview];
break;
}
}
}
And it worked.. but that results in missing the cursor, and disabling any selection :(
I think you'll have to disable autocorrect..
I'll re-start the bounty if someone finds a real answer!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With