In iOS development, users tend to use the ENTER key on the virtual keyboard when entering text, which is return keys. The Enter can sometimes be "done" (indicating the end of the input), can be "next" (Continuous information input), can be "search" (Input in the Web page), can be "send" (mail input), can be "join" (such as connecting Wi-Fi), and so on. What do we need to set up? Here's how:
(1) Select a text Field and click "Show the Attributes Inspector" on the right to find the return Key below. Find here can customize the function of the ENTER key, such as: Google search, join join, Next Next, send send and so on.
。
(2) Customize Google search:
。
(3) Customize the Send button:
。
It is convenient to customize various enter. In the demand, usually after hitting the ENTER key to hide the keyboard, this should do. One of my previous blogs, "using the soft keyboard for iOS development", said that clicking on other buttons or other parts of the screen hides the keyboard, and now we can hide the keypad by clicking the ENTER key.
(1) Drag a text Field and declare and bind in Swift code:
@IBOutlet weak var inputtextfield:uitextfield!
(2) The current Viewcontroller class inherits a protocol:uitextfielddelegate and implements one of the methods in Uitextfielddelegate: Textfieldshouldreturn (). and add code in Viewdidload (), specifically implemented as follows:
。
Enter the above code, after the input is completed, click the ENTER key can hide the keyboard, is not very convenient?
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
iOS Development custom Keyboard Enter return Key