iOS Development custom Keyboard Enter return Key

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.