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