iOS Basic UI (a) simple QQ login

Source: Internet
Author: User

Achieve functional effects:

(1) interface can enter QQ number and password, click the login background output QQ number and password

(2) Input box has a message, focus on the input box to indicate that the information disappears

(3) When you click the login button, the phone keyboard automatically hidesLearning


Effects: familiarity with control properties, events and code associations


As follows:


implementation process: 1. Drag the corresponding control to the interface, set the control properties



< Span class= "token p" style= "Color:rgb (90,90,90); font-family: ' Microsoft Yahei '; font-size:18px; line-height:29px; White-space:pre-wrap; Outline:none!important ">2. Drag line association variables and events. Obviously, to get the interface input QQ number and password, you have to set the input box variables. Click the button to trigger the event, the code to do the corresponding logical processing.  

The following is the connection of the attribute (the solid only indicates the association):


button Event Wiring Association method:


3. Get QQ number and password, click to unlock login button background output QQ number and password

viewcontroller.m

viewcontroller.m//Simple QQ Login////Created by zxh on 15/8/19.//Copyright (c) 2015 <span style= "font-family: ' Mic Rosoft Yahei '; White-space:pre-wrap; " >zxh</span>. All rights reserved.//#import "ViewController.h" @interface Viewcontroller ()//qq number @property (weak, nonatomic) Iboutlet Uitextfield *num;//Password @property (weak, nonatomic) Iboutlet Uitextfield *pwd;//Login Method-(ibaction) login;@    End@implementation viewcontroller-(void) viewdidload {[Super viewdidload]; Do any additional setup after loading the view, typically from a nib.}    -(void) didreceivememorywarning {[Super didreceivememorywarning]; Dispose of any resources the can be recreated.}    /** * Login */-(ibaction) Login {nsstring *qqnum = Self.num.text;    NSString *pwd = Self.pwd.text;        NSLog (@ "num=%@,pwd=%@", qqnum,pwd);    Exit keyboard//Responder//First responder: The control that calls out the keyboard//Improper first responder (will put the keyboard back)//mode one//[self.num Resignfirstresponder];        [Self.pwd Resignfirstresponder]; Mode two view settings edit end    [Self.view endediting:yes];//exit Keyboard} @end 


Get everyone wondering: Why are attributes written in. m files instead of. h files? This is because the QQ number and password is not provided for outside use, we'd better not expose it. All written in. m files.


--Article to this!

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

iOS Basic UI (a) simple QQ login

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.