简体   繁体   English

显示键盘,顶部有按钮列表

[英]display keyboard with button list on the top

I hope to push keyboard with button list on the top of the keyboard. 我希望按键盘顶部的按钮列表来推动键盘。 Please refer to the image 请参考图片

在此处输入图片说明

Is it possible? 可能吗?

you need to add a toolbar. 您需要添加一个工具栏。 Here is an example I used for an action sheet - you can make the modifications for the keyboard easily: 这是我用于操作表的示例-您可以轻松地对键盘进行修改:

  //DEFINING TOOL BAR 
UIToolbar * keyboardToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
keyboardToolbar.barStyle = UIBarStyleBlackOpaque;
[keyboardToolbar sizeToFit];    
NSMutableArray *barItems = [[NSMutableArray alloc] init];
UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
[barItems addObject:flexSpace];
UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissKeyboard:)];
[barItems addObject:doneBtn];
[keyboardToolbar setItems:barItems animated:YES];
[keyboard addSubview:keyboardToolbar]; 

You can obviously add more items to the UIToolBar for "Next", "Previous", etc. 您显然可以为“下一个”,“上一个”等向UIToolBar添加更多项。

It is possible. 有可能的。 Here is a link to a keyboard controls project on github. 这是github上键盘控制项目的链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM