IOS Development Study Notes-(2) keyboard control, keyboard type settings, alert dialog box

Source: Internet
Author: User
Tags exit in

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




Related Article

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.