【发布时间】:2014-08-13 17:28:54
【问题描述】:
现在,我正在开发第三方键盘,遇到一个问题,我想像系统键盘一样获取键盘的候选视图,但找不到获取它的属性或方法。
所以我想用这两种方法来解决问题,
-
一个是改变 UIInputView 的大小,在我看到这个之后,“此外,当您点击顶行中的一个键时,无法在顶行上方显示键图,就像 iPhone 上的系统键盘所做的那样。 "我发现这是不可能的。
第二种方法是找到一个属性或方法来获取候选,我尝试使用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