Tips for using the soft keyboard for iOS development
Source: Internet
Author: User
<span id="Label3"></p><p><p>In the course of iOS development, it is sometimes necessary to eject a soft keyboard for input, and sometimes to hide the soft keyboard in some cases to improve the user Experience. Today there are a few tips on soft keyboards to share with YOU.</p></p><p><p>(1) Pop-up numeric keypad only</p></p><p><p>There are some requirements that require users to only enter numbers in the text field, What do you need to do? A regular expression can be written to determine user input, to match characters, and so On. But it's all about writing Code. Programmers are Lazy-loving. In ios, you can make a pop-up as a numeric keypad by simply setting it so that the user input is only a number.</p></p><p><p>Select a text Field. Select Show the Attributes inspector on the Right. select the keyboard type in the keyboard type below, such as the number Pad you can select. This allows you to enter only a number.</p></p><p><p>。</p></p><p><p><br></p></p><p><p>The implementation results are as Follows:</p></p><p><p>。</p></p><p><p><br></p></p><p><p>(2) hide the keyboard after clicking the button</p></p><p><p>In the actual development needs, may the user after losing the text, the click a button, indicates the input completes, should hide the keyboard at this Time. Instead of the keyboard is always displayed on the interface, affecting the user experience. The implementation as long as the button click, the focus from the input box to Remove.</p></p><p><p>。</p></p><p><p>After implementing the above code, you can hide the keyboard by tapping the Button.</p></p><p><p><br></p></p><p><p>(3) Click anywhere on the screen to hide the keyboard</p></p><p><p>In our use of the process, often through the scrolling interface, or click any area to hide the keyboard, this time what should be done? This requires overriding method touchesended (). the implementation is as Follows:</p></p><p><p>。</p></p><p><p><br></p></p><p><p>There are a lot of tips on how to operate the keyboard, and i'll share it with you later.<br></p></p><p><p><br></p></p><p><p><br></p></p> <p style="font-size:12px;"><p style="font-size:12px;">Copyright Notice: This article for Bo Master original article, without Bo Master permission not Reproduced.</p></p> <p><p>Tips for using the soft keyboard for iOS development</p></p></span>
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