有没有办法强制使用Apple号码键盘?

时间:2018-01-04 16:07:02

标签: objective-c keyboard ios11

我最近升级了我的应用程序,并使用WordFlow键盘从用户处获得了一个奇怪的错误报告。这不常见,但现在当这个键盘弹出时,它会将我的视线从屏幕上移开。

我只想在这些字段中使用数字键盘,因为它们只接受数字。

我的故事板以这种方式设置:

<textInputTraits key="textInputTraits" keyboardType="numberPad" keyboardAppearance="alert" returnKeyType="next" enablesReturnKeyAutomatically="YES"/>

键盘显示时,我按如下方式偏移视图

- (void)keyboardWasShown:(NSNotification*)aNotification
{
    NSDictionary* info = [aNotification userInfo];
    CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
    UIEdgeInsets contentInsets = UIEdgeInsetsMake(0.0, 0.0, kbSize.height, 0.0);
    UIScrollView *scrollView = (UIScrollView *)[self view];
    scrollView.contentInset = contentInsets;
    scrollView.scrollIndicatorInsets = contentInsets;

    kbHeight = kbSize.height;

    CGRect aRect = self.view.frame;
    aRect.size.height -= kbSize.height;
    if (!CGRectContainsPoint(aRect, self.activeField.frame.origin) ) {
        keyboard = TRUE;
        scrollView.frame = CGRectOffset( scrollView.frame, 0, kbHeight*-1);
    }
}

然而,使用WordFlow键盘(不再可用),这不起作用。我只想让它总是使用Apple的数字键盘而不是第三方 - 这可能吗?

谢谢!

0 个答案:

没有答案