Swift-keyboard Popup style

Source: Internet
Author: User

Swift offers 11 types of keyboards:

In the development, we can choose different keyboard styles according to different needs, for example, when we only need to enter the phone number, we can choose the pure numeric type of keyboard (. Numbersandpunctuation), when we need to enter a URL, you can choose a URL-style keyboard (. url), where the default keyboard style (. Default) is the (. namephonepad) style.

We can set the keyboard style by uikeyboardtype the input box

Uitextfield(). Keyboardtype =. Namephonepad

//

Uikeyboardtype

//

Requests that a particular keyboard type is displayed when a text widget

becomes first responder.

Note:some Keyboard/input methods types may not support every variant.

In such cases, the input method would make a best effort to find a close

Match to the requested type (e.g. displaying uikeyboardtypenumbersandpunctuation

Type if Uikeyboardtypenumberpad is not supported).

//

Public enum uikeyboardtype: Int {

case Default //default type for the current input method.

case asciicapable //displays a keyboard which can enter ASCII characters, non-ascii keyboards remain active

case numbersandpunctuation //Numbers and assorted punctuation.

case URL //A type optimized for URL entry (shows./. com prominently).

case Numberpad //A number pad (0-9). Suitable for PIN entry.

case Phonepad //A phone pad (1-9, *, 0, #, with letters under the numbers).

case Namephonepad //a type optimized for entering a person ' s name or phone number.

case EmailAddress //A type optimized for multiple email address entry (shows space @. prominently).

@available(IOS 4.1, *)

case Decimalpad //A number pad with A decimal point.

@available(IOS 5.0, *)

Case Twitter //A type optimized-Twitter text entry (easy access to @ #)

@available(IOS 7.0, *)

case websearch //A default keyboard type with url-oriented addition (shows space. prominently).

public static var Alphabet: uikeyboardtype {get} //Deprecated

}

The following image shows the difference

Default

Numbersandpunctuation

Url

Numberpad

Phonepad

EmailAddress

Decimalpad

Twitter

Websearch

Swift-keyboard Popup style

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.