如何使popup式键盘字符在iOS8自定义键盘?

我想创buildpopup式iOS8自定义键盘如下图所示。

想要在iOS8中创建这种类型的键盘

一些代码正在工作,但不能访问键盘的外部窗口,发生如下图所示的问题-2

问题在iOS8自定义键盘

从Apple App Extension编程指南 :

最后,不能在自定义键盘的主视图的顶部边缘上方显示关键graphics,因为系统键盘在iPhone上按住并保持最上一行中的某个按键时,系统键盘会执行此操作。

所以看起来你不能在键盘框外添加popup窗口,所以codelgnitor的答案是你可以做的最好的。

这是我在我的自定义键盘工作

//adding pop up when character is tapped - (void)addPopupToButton:(UIButton *)button { CGRect frame,frame1; if(self.view.frame.size.width == 320) { //Keyboard is in Portrait frame = CGRectMake(0, -25, 28, 43); frame1=CGRectMake(0, 0, 28, 43); } else{ //Keyboard is in Landscape frame = CGRectMake(3, -25, 35, 43); frame1=CGRectMake(0, 10, 35, 43); } //create pop up view UIView *popUp=[[UIView alloc]initWithFrame:frame]; //create a label to add to pop up view UILabel *text = [[UILabel alloc] init]; //set frame for the label and set label title [text setFrame:frame1]; [text setText:button.titleLabel.text]; text.textAlignment=NSTextAlignmentCenter; [text setFont:[UIFont boldSystemFontOfSize:30]]; text.backgroundColor=[UIColor whiteColor]; //add label as popup view's subview [popUp addSubview:text]; //add pop up view as button's subview [button addSubview:popUp]; } //remove Pop up view -(void)endPopUpForButton:(UIButton*)button { if ([button subviews].count > 1) { [[[button subviews] objectAtIndex:1] removeFromSuperview]; } } 

在这里输入图像说明