Return to site

Apple Numeric Keypad Add On

broken image


When users touch a text field, a text view, or a field in a web view, the system displays a keyboard. You can configure the type of keyboard that is displayed along with several attributes of the keyboard. You also have to manage the keyboard when the editing session begins and ends. Because the keyboard could hide the portion of your view that is the focus of editing, this management might include adjusting the user interface to raise the area of focus so that is visible above the keyboard.

Apple Numeric Keypad Add On Keyboard

Keyboards and Input Methods

Whenever the user taps in an object capable of accepting text input, the object asks the system to display an appropriate keyboard. Depending on the needs of your program and the user's preferred language, the system might display one of several different keyboards. Although your app cannot control the user's preferred language (and thus the keyboard's input method), it can control attributes of the keyboard that indicate its intended use, such as the configuration of any special keys and its behaviors.

Configuring the Keyboard for Text Objects

A numeric keypad is an extended layout of additional keys, including numbers, to the right of a regular keyboard. The keypad works in different ways, depending on your Mac and the keyboard and app you're using. Usually you use the numeric keypad to enter numbers, but you can also use it to move the pointer and, in some apps, to move around. Aug 30, 2018 How to add an Apple Magic Keyboard to a Windows 10 PC Watch Now While some users prefer the tactile feel of a solid mechanical keyboard, others opt for a streamlined and simple looks. Ever had to add a phone number, credit card number, or any other long list of digits on an app or website and they DIDN'T provide a number pad keyboard? With NumPad: Your Number Keyboard, that overwhelming feeling of loss, loathing, and general sadness disappears instantly, just by switching keyboards.

You configure the attributes of the keyboard directly through the text objects of your app. The UITextField and UITextView classes both conform to the UITextInputTraitsprotocol, which defines the properties for configuring the keyboard. Setting these properties programmatically or in the Interface Builder inspector window causes the system to display the keyboard of the designated type.

The default keyboard configuration is designed for general text input. Figure 4-1 displays the default keyboard along with several other keyboard configurations. The default keyboard displays an alphabetical keyboard initially but the user can toggle it and display numbers and punctuation as well. Most of the other keyboards offer similar features as the default keyboard but provide additional buttons that are specially suited to particular tasks. However, the phone and numerical keyboards offer a dramatically different layout that is tailored towards numerical input.

To implement the language preferences of different users, iOS also supports different input methods and keyboard layouts for different languages, some of which are shown in Figure 4-2. The input method and layout for the keyboard is determined by the user's language preferences. Input for some of these keyboards takes place in multiple stages.

Configuring the Keyboard for Web Views

Newest macbook software. You can configure some keyboard attributes for text input elements. For example, you can include autocorrect and autocapitalize attributes in the definition of an input element to specify the keyboard's behaviors, as shown in the following example.

You can also control which type of keyboard is displayed when a user touches a text field in a web page. To display a telephone keypad, an email keyboard, or a URL keyboard, use the tel, email, or url keywords for the type attribute on an input element, respectively. To display a numeric keyboard, set the value of the pattern attribute to '[0-9]*' or 'd*'.

These keywords and the pattern attribute are part of HTML 5 and are available in iOS. The following list shows how to display each type of keyboard, including the standard keyboard.

  • Text:

  • Telephone:

  • URL:

  • Email:

  • Zip code:

Keypad

Managing the Keyboard

Although many UIKit objects display the keyboard automatically in response to user interactions, your app still has some responsibilities for configuring and managing the keyboard. The following sections describe those responsibilities.

Receiving Keyboard Notifications

When the keyboard is shown or hidden, iOS sends out the following notifications to any registered observers:

Each keyboard notification includes information about the size and position of the keyboard on the screen. You can access this information from the userInfo dictionary of each notification using the UIKeyboardFrameBeginUserInfoKey and UIKeyboardFrameEndUserInfoKey keys.

You should always use the information in these notifications as opposed to assuming the keyboard is a particular size or in a particular location. The size of the keyboard is not guaranteed to be the same from one input method to another and may also change between different releases of iOS. In addition, even for a single language and system release, the keyboard dimensions can vary depending on the orientation of your app. For example, Figure 4-3 shows the relative sizes of the URL keyboard in both the portrait and landscape modes. Using the information inside the keyboard notifications ensures that you always have the correct size and position information.

Note: The rectangle contained in the UIKeyboardFrameBeginUserInfoKey and UIKeyboardFrameEndUserInfoKey properties of the userInfo dictionary should be used only for the size information it contains. Do not use the origin of the rectangle (which is always {0.0, 0.0}) in rectangle-intersection operations. Because the keyboard is animated into position, the actual bounding rectangle of the keyboard changes over time.

One reason to use keyboard notifications is so that you can reposition content that is obscured by the keyboard when it is visible. For information on how to handle this scenario, see Moving Content That Is Located Under the Keyboard.

There is no defined relationship between the timing of keyboard notifications and the timing of view-controller transitions.

Displaying the Keyboard

When the user taps a view, the system automatically designates that view as the first responder. When this happens to a view that contains editable text, the view initiates an editing session for that text. At the beginning of that editing session, the view asks the system to display the keyboard, if it is not already visible. If the keyboard is already visible, the change in first responder causes text input from the keyboard to be redirected to the newly tapped view.

Because the keyboard is displayed automatically when a view becomes the first responder, you often do not need to do anything to display it. However, you can programmatically display the keyboard for an editable text view by calling that view's becomeFirstResponder method. Calling this method makes the target view the first responder and begins the editing process just as if the user had tapped on the view.

If your app manages several text-based views on a single screen, it is a good idea to track which view is currently the first responder so that you can dismiss the keyboard later.

Dismissing the Keyboard

Although it typically displays the keyboard automatically, the system does not dismiss the keyboard automatically. Instead, it is your app's responsibility to dismiss the keyboard at the appropriate time. Typically, you would do this in response to a user action. For example, you might dismiss the keyboard when the user taps the Return or Done button on the keyboard or taps some other button in your app's interface. Depending on how you configured the keyboard, you might need to add some additional controls to your user interface to facilitate the keyboard's dismissal.

To dismiss the keyboard, you call the resignFirstResponder method of the text-based view that is currently the first responder. When a text view resigns its first responder status, it ends its current editing session, notifies its delegate of that fact, and dismisses the keyboard. In other words, if you have a variable called myTextField that points to the UITextField object that is currently the first responder, dismissing the keyboard is as simple as doing the following:

Everything from that point on is handled for you automatically by the text object.

Moving Content That Is Located Under the Keyboard

When asked to display the keyboard, the system slides it in from the bottom of the screen and positions it over your app's content. Because it is placed on top of your content, it is possible for the keyboard to be placed on top of the text object that the user wanted to edit. When this happens, you must adjust your content so that the target object remains visible.

Adjusting your content typically involves temporarily resizing one or more views and positioning them so that the text object remains visible. The simplest way to manage text objects with the keyboard is to embed them inside a UIScrollView object or one of its subclasses, like UITableView. Note that UITableViewController automatically resizes and repositions its table view when there is inline editing of text fields (to learn more, see View Controllers and Navigation-Based Apps).

When the keyboard is displayed, all you have to do is reset the content area of the scroll view and scroll the desired text object into position. Thus, in response to a UIKeyboardDidShowNotification, your handler method would do the following:

Apple Numeric Keyboard

  1. Get the size of the keyboard.

  2. Adjust the bottom content inset of your scroll view by the keyboard height.

  3. Scroll the target text field into view.

Note: Because the height of the keyboard can change during its transition onto the screen, you should always use UIKeyboardFrameEndUserInfoKey to help you avoid having your content get obscured by the keyboard.

Figure 4-4 illustrates the preceding steps for a simple app that embeds several text fields inside a UIScrollView object. When the keyboard appears, the notification handler method adjusts the content and scroll indicator insets of the scroll view and then uses the scrollRectToVisible:animated: method of UIScrollView to scroll the tapped text field (in this case the email field) into view.

Listing 4-1 shows the code for registering to receive keyboard notifications and shows the handler methods for those notifications. This code is implemented by the view controller that manages the scroll view, and the scrollView variable is an outlet that points to the scroll view object. The keyboardWasShown: method gets the keyboard size from the info dictionary of the notification and adjusts the bottom content inset of the scroll view by the height of the keyboard. It also sets the scrollIndicatorInsets property of the scroll view to the same value so that the scrolling indicator won't be hidden by the keyboard. Note that the keyboardWillBeHidden: method doesn't use the keyboard size; it simply sets the scroll view's contentInset and scrollIndicatorInsets properties to the default value, UIEdgeInsetsZero.

If the active text field is hidden by the keyboard, the keyboardWasShown: method adjusts the content offset of the scroll view appropriately. The active field is stored in a custom variable (called activeField in this example) that is a member variable of the view controller and set in the textFieldDidBeginEditing: delegate method, which is itself shown in Listing 4-2. (In this example, the view controller also acts as the delegate for each of the text fields.)

Listing 4-1 Handling the keyboard notifications

Listing 4-2 shows some additional code used by the view controller to set and clear the activeField variable in the preceding example. During initialization, each text field in the interface sets the view controller as its delegate. Therefore, when a text field becomes active, it calls these methods. For more information on text fields and their delegate notifications, see Managing Text Fields and Text Views.

Listing 4-2 Additional methods for tracking the active text field.

There are other ways you can scroll the edited area in a scroll view above an obscuring keyboard. Instead of altering the bottom content inset of the scroll view, you can extend the height of the content view by the height of the keyboard and then scroll the edited text object into view. Although the UIScrollView class has a contentSize property that you can set for this purpose, you can also adjust the frame of the content view, as shown in Listing 4-3. This code also uses the setContentOffset:animated: Movie apps for macbook air. method to scroll the edited field into view, in this case scrolling it just above the top of the keyboard.

Listing 4-3 Adjusting the frame of the content view and scrolling a field above the keyboard



Copyright © 2018 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2018-01-16

Change your keyboard settings

You can change the settings of the built-in keyboard on your device or add languages. This also changes the dictionary used for auto-correction, the number of letters on the keyboard, and the arrangement of the keys. The language of the keyboard also determines the language of the dictionary used for predictive text.

To adjust your keyboard settings:

  1. Open an app that uses the keyboard, like Messages or Mail.
  2. Touch and hold or .
  3. Tap Keyboard Settings.
  4. Then customize your settings.

Add or delete a third-party keyboard app

You can install third-party keyboard apps just like you install other apps on your device. After you install a new keyboard, you need to add it before you can use it. Follow these steps:

  1. Go to the App Store and find the keyboard app that you want.
  2. Tap Get, then follow the prompts to install.
  3. Enter your Apple ID password, or use Face ID or Touch ID if it's available on your device.
  4. Then add the new keyboard. Go to Settings > General > Keyboard > Keyboards > Add a New Keyboard and select the app that you installed. You might need to set the keyboard to allow full access in order to use it.

To delete a third-party keyboard:

  1. Go to Settings > General, tap Keyboard, then tap Keyboards.
  2. Tap Edit.
  3. Tap , then tap Done.

You can also delete a keyboard by deleting the companion app that you installed from the App Store. This also removes the keyboard from Settings.

Switch to another keyboard

While you're using an app, you can switch to a different keyboard, like a third-party keyboard or a language keyboard. Follow these steps:

  1. Touch and hold or .
  2. Select the keyboard you want to use.

To arrange the order of your keyboards:

  1. Go to Settings > General > Keyboard and tap Keyboards.
  2. Tap Edit.
  3. Touch and hold to move the keyboard.
  4. Tap Done.

Sometimes, third-party keyboards aren't available for one of these reasons:

  • If the developer of the app you're using doesn't allow third-party keyboards.
  • If you type in a secure text field, like a password entry that shows typed characters as dots instead of letters and numbers.
  • If you use a number pad instead of a standard keyboard.

Instead, you'll see the default keyboard until you finish typing.

Turn on one-handed typing

Apple Numeric Keypad Add On Mac

Use one-handed typing on your iPhone to make it easier to type with one hand. Here's how:

  1. Touch and hold or .
  2. Tap to move the keyboard to the left. Tap to move the keyboard to the right.
  3. When you're done, touch and hold or . Then tap to bring your keyboard back to its usual setting.

You can also turn on one-handed typing from Settings > General > Keyboards and tap One Handed Keyboard. You need an iPhone 6 or later to use the one-handed keyboard. This feature excludes iPhone SE (1st generation) and iPod touch.

If you have an iPhone 6 or later, the one-handed keyboard doesn't work if you have your display set to Zoomed instead of Standard. If you have an iPhone 6 Plus or later, the one-handed keyboard will work if your display is set to Zoomed or Standard. To adjust your display settings, go to Settings > Display & Brightness > Display Zoom.

Change the layout of your physical keyboard

You can choose between multiple keyboard layouts to match the keys on your physical keyboard. You can also use an alternative keyboard layout that doesn't match the keys on your physical keyboard.

Before you can change your physical keyboard, you need to pair it with your iPhone, iPad, or iPod touch. Follow the instructions that came with your keyboard to place it in discovery or pair mode. After you pair it, go to Settings > General > Hardware Keyboard, then select a layout.

Apple Numeric Keypad Add On Ipad

Learn how to set up and use a Bluetooth accessory — like a keyboard — with your device.





broken image