This is for converting Zawgyi character into proper words. It is written with Objective-C for iOS App. Implementations are extracted from TaKaung Keyboard App and moved to embedded framework.
https://www.facebook.com/TaKaungKeyboard/
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
self.inputStr = string;
return YES;
}
- (void)textFieldDidChange:(UITextField *)textField {
if (!self.inputStr || self.inputStr.length == 0)
return;
textField.text = [self.convert convertExistingString:textField.text withInputCharacter:[self.inputStr characterAtIndex:0]];
}
Convert *conv = [[Convert alloc] initWithAddTextBlock:^(NSString *str) {
[self.textDocumentProxy insertText:str];
} andDeleteText:^{
[self.textDocumentProxy deleteBackward];
}]; //Set up
[self.conv convertExistingText:self.textDocumentProxy.documentContextBeforeInput withInputCharacter:[character characterAtIndex:0]]; // Put all existing text and new character that user just type (1 char only)