我已经使用其他线程中发布的解决方案向数字小键盘添加了一个自定义的"完成"按钮,就像这个.随着iOS 8.3的更新,一些东西已经改变,因为按钮仍然出现,但触摸通知永远不会触发.将按钮从键盘视图移动到超级视图会破坏按钮的位置,但会证明控件工作的通知.
它的行为类似于自定义按钮位于键盘上的透明层后面,并且无法进行任何触摸.
- (void)addButtonToKeyboard
{
// create custom button
self.doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.doneButton.frame = CGRectMake(0, 163+44, 106, 53);
self.doneButton.adjustsImageWhenHighlighted = NO;
[self.doneButton setTag:67123];
[self.doneButton setImage:[UIImage imageNamed:@"doneup1.png"] forState:UIControlStateNormal];
[self.doneButton setImage:[UIImage imageNamed:@"donedown1.png"] forState:UIControlStateHighlighted];
[self.doneButton addTarget:self action:@selector(doneButton:) forControlEvents:UIControlEventTouchUpInside];
// locate keyboard view
int windowCount = [[[UIApplication sharedApplication] windows] count];
if (windowCount < 2) {
return;
}
UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];
UIView* keyboard;
for(int i = 0 ; i < [tempWindow.subviews count] ; i++)
{
keyboard = …Run Code Online (Sandbox Code Playgroud)