简体   繁体   中英

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.

It is possible. Here is a link to a keyboard controls project on github.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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