IOS learning 03 QQ login interface, ios03

Source: Internet
Author: User

IOS learning 03 QQ login interface, ios03

Now I am studying IOS development and developing a simple QQ login interface, for example:

1.1 create a project and design interface. The interface is like two labels, two texts, and a Button login Button. The interface is relatively simple, for example.

2.2 set properties. In the text box that you enter the QQ number, enter "Please enter the QQ number" in the Placeholder attribute. When the program starts, it is automatically displayed in the input text box of the QQ number.

2.3 set the Clear Button = Appears while editing attribute of text. This attribute is used when the program is running. When the QQ number is entered in the text box, an x number will appear at the end of the text box, allowing users to delete it at any time.

Enter the incorrect text.

2.4 set the content Keyboard that can be entered in the QQ input box. Because the QQ numbers are all numbers, we can set the attribute Keyboard = Number Pad, in this way, only numbers are displayed on the keyboard when you click the QQ number text box.

2.5 set the attributes of the QQ password input box. Because the password can be a combination of different types, you do not need to set the Keyboard attribute, but you need to hook the Secure attribute to this attribute, the text you entered will not be displayed in plain text, as shown in.

3.1 after the attributes of these controls are set, we will write the background code.

//// ViewController. m // QQ login // Created by Xu Zhou on 15-5-28. // Copyright (c) 2015 ___ FULLUSERNAME ___. all rights reserved. // # import "ViewController. h "@ interface ViewController () // create a login event and associate it with the interface login Button-(IBAction) Button; // create a text attribute and associate it with the QQ number input box @ property (weak, nonatomic) IBOutlet UITextField * qqtext; // create a text attribute and associate it with the QQ password input box @ property (weak, nonatomic) IBOutlet UITextField * qqpwe; @ end @ implementation ViewController // logon event-(IBAction) Button {NSString * qqtext = self. qqtext. text; NSString * qqpwd = self. qqpwe. text; // manually set the user name and password. The value is NSString * text = @ "123456"; NSString * pwd = @ "xuzhou "; // determine whether the user name and password entered by the user are correct if ([qqtext isEqualToString: text] = YES & [qqpwd isEqualToString: pwd] = YES) {// if both the user name and password are correct, the pop-up dialog box // NSString * str = @ "Login successful"; UIAlertView * alterview = [[UIAlertView alloc] initWithTitle: @ "" message: str delegate: self cancelButtonTitle: @ "OK" otherButtonTitles: nil, nil]; // display the content on the screen [alterview show];} else // if the user name or password is incorrect {// the error message NSString * str = @ "Logon failed, the user name or password is incorrect"; UIAlertView * alterview = [[UIAlertView alloc] initWithTitle: @ "" message: str delegate: self cancelButtonTitle: @ "OK" otherButtonTitles: nil, nil]; // display the content on the screen [alterview show];} // exit the keyboard [self. view endEditing: YES];} @ endView Code

3.2 after the current interface and background code are completed, enter the QQ number 123456 and password xuzhou. The logon is successful, for example:

3.3 OK. A simple QQ login is complete. Learn IOS step by step and write the project later.

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.