IOS Development Study Notes-(2) keyboard control, keyboard type settings, alert dialog box
1. Disable the keyboard and discard the first responder. There are two solutions:
① Bind the event with the Did End on Exit in the text box
② UIControl on Touch events all operate sender's resignFirstResponder
# Import
@ Interface ViewController: UIViewController @ property (weak, nonatomic) IBOutlet UITextField * txtUserName; @ property (weak, nonatomic) IBOutlet UITextField * txtUserPwd;-(IBAction) identifier :( id) sender; // disable the keyboard-(IBAction) hideKeyBorad :( id) sender; @ end
In the. m file
// Discard the first responder-(IBAction) hideKeyBorad :( id) sender {[txtUserName resignFirstResponder]; [txtUserPwd resignFirstResponder];}
Associate events as follows:
2. the keyboard type and Return Key are implemented by setting the attributes of the text box, such:
3. the alert dialog box is displayed. Bind The event of the test logon button and set the alert to pop up.
<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHByZSBjbGFzcz0 = "brush: java;"> UIAlertView * alertView = [[UIAlertView alloc] initWithTitle: @ "tip" message: @ "Hello, data has been updated" delegate: self cancelButtonTitle: @ "cancel" otherButtonTitles: @ "OK", @ "select", @ "vote", nil]; [alertView show];
The running effect is as follows:
Address: http://download.csdn.net/detail/jiangtao_st/7684869