How to stop my Custom Keyboard from 'floating&

2019-04-18 20:44发布

I have a custom Keyboard that gets displayed for a certain UITextField when I set the textField's inputView to my KeyboardView. The keyboard works fantastically well but it has become apparent that the keyboard will 'float' if the user has previously undocked the built in Apple Keyboard or indeed split it.

I have searched for many hours for a way to ensure my custom keyboard does not act like this and instead stays docked to the bottom of the screen regardless as to whether the user has previously undocked the built in Apple Keyboard.

self.keyboardInputView = [[[KeyboardInputViewController_iPad alloc]
                            initWithNibName:@"KeyboardInputViewController_iPad"
                            bundle:[NSBundle mainBundle]] autorelease];
self.keyboardInputView.delegate = self;                
self.keyboardInputView.keyboardTextField = myTextField;
myTextField.inputView = self.keyboardInputView.view;
[myTextField becomeFirstResponder];

1条回答
Animai°情兽
2楼-- · 2019-04-18 21:13

You shouldn't do this, neither is there a way to do so.

You cannot override user settings with a custom keyboard, especially not the ones that can improve the accessiblity of a user interface.

You could include a warning in the tutorial that your keyboard works best while being locked to the bottom, but you must ask yourself the question whether this is good UX or not. I would say the latter.

查看更多
登录 后发表回答