简体   繁体   中英

Add a clickable “Done” UIButton in the top of keyboard

I would like to add a UIButton in the top of keyboard in my app view. Any idea on how to do this?

You need to set the inputAccessoryView property on your text field.

This can be any view - so, for example, a toolbar with a done button. Example:

   UIToolbar * myToolbar = [[[UIToolbar alloc] initWithFrame.... etc
   // Add button to toolbar here

   myTextField.inputAccessoryView = myToolbar;

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