【问题标题】:iOS8 how to get the candidate View of custom keyboardiOS8如何获取自定义键盘的候选View
【发布时间】:2014-08-13 17:28:54
【问题描述】:

现在,我正在开发第三方键盘,遇到一个问题,我想像系统键盘一样获取键盘的候选视图,但找不到获取它的属性或方法。

所以我想用这两种方法来解决问题,

  1. 一个是改变 UIInputView 的大小,在我看到这个之后,“此外,当您点击顶行中的一个键时,无法在顶行上方显示键图,就像 iPhone 上的系统键盘所做的那样。 "我发现这是不可能的。

    [链接]iOS 8 Custom Keyboard

  2. 第二种方法是找到一个属性或方法来获取候选,我尝试使用inputAccessoryView作为候选面板,但它与UITextView和UITextField绑定,它属于应用程序,而不是自定义键盘。

这里是代码
CGRect accessFrame = CGRectMake(0.0, 0.0, 768.0, 77.0);

inputAccessoryView = [[UIView alloc] initWithFrame:accessFrame];

inputAccessoryView.backgroundColor = [UIColor blueColor];

UIButton *compButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];

compButton.frame = CGRectMake(313.0, 20.0, 158.0, 37.0);

[compButton setTitle: @"Word Completions" forState:UIControlStateNormal];

[compButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

[compButton addTarget:self action:@selector(completeCurrentWord:)
            forControlEvents:UIControlEventTouchUpInside];

[inputAccessoryView addSubview:compButton];

【问题讨论】:

  • 可以发截图吗?
  • 碰到这个问题 - 你有截图吗?

标签: keyboard ios8 ios-app-extension candidate inputaccessoryview


【解决方案1】:

实际上,您无法像系统键盘那样获得候选视图。如果您需要候选视图,到目前为止唯一的方法是增加键盘的高度并“制作”您自己的候选视图。看看 Flesky 是怎么做的,你可能会找到一些灵感。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多