iOS Development Learning notes-(2) Keyboard control, keyboard type Settings, Alert dialog box

Source: Internet
Author: User

One, close the keyboard, give up the first responder, the process of thinking there are two

① using the Do End on Exit binding event for a text box

②uicontrol on Touch event to operate sender's Resignfirstresponder

#import <UIKit/UIKit.h> @interface viewcontroller:uiviewcontroller@property (weak, nonatomic) Iboutlet Uitextfield *txtusername; @property (weak, nonatomic) Iboutlet Uitextfield *txtuserpwd;-(ibaction) Onclick_userlogin: ( ID) sender;//off keyboard-(ibaction) Hidekeyborad: (ID) sender; @end


In the. m file

Discard First Responder-(ibaction) Hidekeyborad: (ID) sender{    [txtUserName resignfirstresponder];    [Txtuserpwd Resignfirstresponder];}

Associate the event as follows



Second, keyboard type, Return Key, by setting the text box properties to achieve, switch, email input box, number digital input box, weburl input box, such as:




The Alert dialog box displays the event that binds the test login button, setting the popup alert

     Uialertview *alertview = [[Uialertview alloc] initwithtitle:@ "Warm tip"                                  message:@ "Hello, data has been updated" delegate:self cancelbuttontitle:@ "Cancel"                                    otherbuttontitles:@ "OK", @ "Please select", @ "please vote", Nil];        [Alertview show];

The results are as follows:



Code Address: http://download.csdn.net/detail/jiangtao_st/7684869




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.