Advanced 11_proxy design mode_simple keyboard processing

Source: Internet
Author: User

Proxy design mode:

1. Use Cases-"a wants B to help with some things, so B becomes a proxy for A." a wants to notify B that something has happened, or, if you want to pass some data to B, you can make B a proxy for, let B be the proxy of A 2. Use step-define an agreement-"B must abide by the agreement and implement the corresponding method-" a should define a proxy attribute, ID <protocol> delegate-> creates the B object and sets the delegate attribute of a to the simple processing of the keyboard of the B object: Textfield: keyborad type attribute Default and name phone pad numbers and punctuation URL Number pad phone Pade-mail address decimal pad Twitter web search Textfield: Clear button: whether to display the Clear button Appears while editing: When editing, is always visible: always appears. The two effects are the same. Never appears: never appears (default) appears unless Editing: exit the keyboard when the text box loses focus :/*

Responder: the object that can process the event

First responder: the text box control that calls the keyboard

How to exit the keyboard: a text box control does not want to be the first responder

*/

[_ Phonefield resignfirstresponder];

// All text boxes in self. View exit the keyboard. If there is a view control and textfield in the View control, the keyboard is also exited.

[Self. View endediting: Yes];

Add a toolbar to the top of the keyboard

// Load the toolbar on the keyboard only once, so it is written in the viewdidload method.

// 1. Load XIB to create a toolbar

Uitoolbar * keyboardtool = [[nsbundle mainbundle] loadnibnamed: @ "keyboradtool" Owner: Nil options: Nil];

// Set the toolbar at the top of the text box

_ Phonefield. inputaccessoryview = keyboardtool;

// The text box becomes the first responder

[_ Phonefield becomefirstresponder];

// Custom keyboard

_ Phonefield. inputview =;

Advanced 11_proxy design mode_simple keyboard processing

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.