iOS development in Storybord hidden keyboard method

Source: Internet
Author: User

First, hide their own soft keyboard

When there are multiple Uitextfield controls that want to hide their soft keyboard by clicking "Return", the best way to do this is to use the Do End on Exit event. This event is triggered when you click the Return button in the lower-right corner of the soft keyboard.
The event has a sender parameter that represents the current text box, so you can write a common event-handling method (. m file).

-(Ibaction) Textfield_didendonexit: (ID) sender {        [sender Resignfirstresponder];}

Then fill in the declaration of the method in the. h file--

-(Ibaction) Textfield_didendonexit: (ID) sender;

go back to storyboard and press Command+option+enter to open the secondary window so that the secondary window displays the. h file. Select a Uitextfield control, click the right mouse button pop-up panel, the left mouse button hold the circle next to the Do End on Exit event, and then drag to the right. h file on the Textfield_didendonexit method, the event connection is established. You then follow the same procedure to connect the Do End on exit events of other Uitextfield controls to the Textfield_didendonexit method.

Running, you can find the soft keyboard for each text box to be hidden by clicking "Return".

iOS development in Storybord hidden keyboard method

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.