I have added textfield (keyboardTextField) and UISwitch on top of my custom keyboard. I can set focus ON or OFF for (keyboardTextField) on the base of Switch value my code.
- (void)switchToggled:(id)sender
{
UISwitch *mySwitch = (UISwitch *)sender;
if ([mySwitch isOn])
{
[keyboardTextField becomeFirstResponder];
}
else
{
[keyboardTextField resignFirstResponder];
}
}
So whats happening right now at first time when my custom keyboard launch its working in each app of my device,But it's impossible for me to select the input view of the main app back after changing Switch value to On and then OFF and now my custom keyboard can't write any thing in any app of my device.
This type of questions already has been asked here and here but no one answered yet. If someone have any workaround or any ideas, Please share.
I'm making an extension keyboard for IOS and have same problem like you. My purpose is to add an UISearchBar
to keyboard like this app but I could not find an answer in any forum where I posted this question.
I even asked Apple Technical support but they answered that this is a bug of iOS keyboard extension.
Last day I found an app is Kanvas keyboard and I think a have my solution, and that's use an UILabel
instead UITextField
or UISearch
in the extension.
That will keep my app work fine. Hope this can help you.
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