QQ login interface layout of SWift development instances and swift instance interface Layout

Source: Internet
Author: User

QQ login interface layout of SWift development instances and swift instance interface Layout

//

// ViewController. swift

// QQ logon interface Layout

//

// Created by yueda Technology on 15/1/14.

// Copyright (c) 2015 BSY. All rights reserved.

//


Import UIKit


Class ViewController: UIViewController {

/// Define attributes

Var QQNumber = UITextField ()

Var PassNumber = UITextField ()

Override func viewDidLoad (){

Self. view. backgroundColor = UIColor. whiteColor ()

Super. viewDidLoad ()

// Add a header Image

[Self. addAllSubViews ()];

}


// Add all child Controls

Func addAllSubViews (){

/// Avatar

Var headImage = UIImageView (frame: CGRectMake (50, 30,220,200 ))

HeadImage. image = UIImage (named: "QQ.png ")

Self. view. addSubview (headImage)

/// QQ number input prompt

Var phoneText = UILabel (frame: CGRectMake (30,240, UIScreen. mainScreen (). bounds. size. width-60, 30 ))

PhoneText. text = "Enter the QQ number"

Self. view. addSubview (phoneText)

/// QQ number input box

Var QQNumber = UITextField (frame: CGRectMake (30,270, UIScreen. mainScreen (). bounds. size. width-60, 30 ))

QQNumber. placeholder = "Enter the QQ number"

QQNumber. layer. borderWidth = 1

QQNumber. layer. borderColor = UIColor. lightGrayColor (). CGColor

QQNumber. layer. cornerRadius = 5

QQNumber. keyboardType = UIKeyboardType. NumberPad

Self. view. addSubview (QQNumber)

Self. QQNumber = QQNumber

/// Password Input prompt

Var passText = UILabel (frame: CGRectMake (30,300, UIScreen. mainScreen (). bounds. size. width-60, 30 ))

PassText. text = "enter the password"

Self. view. addSubview (passText)

/// Password input box

Var PassNumber = UITextField (frame: CGRectMake (30,330, UIScreen. mainScreen (). bounds. size. width-60, 30 ))

PassNumber. placeholder = "enter the password"

PassNumber. layer. borderWidth = 1

PassNumber. layer. borderColor = UIColor. lightGrayColor (). CGColor

PassNumber. layer. cornerRadius = 5

Self. view. addSubview (PassNumber)

Self. PassNumber = PassNumber

/// Retrieve the password

Var button = UIButton (frame: CGRectMake (200,360,120, 30 ))

UIButton. buttonWithType (UIButtonType. Custom)

Button. setTitle ("forgot password", forState: UIControlState. Normal)

Button. setTitleColor (UIColor. lightGrayColor (), forState: UIControlState. Normal)

Self. view. addSubview (button)

Button. addTarget (self, action: "onClick", forControlEvents: UIControlEvents. TouchUpInside)

}


/// Password retrieval method implementation

Func onClick (){

/// Password retrieval prompt

UIAlertView (title: "tip", message: "the new password has been sent to the mobile phone", delegate: nil, cancelButtonTitle: "OK", otherButtonTitles: "cancel"). show ()

}

/**

Click the UI keyboard to quit the first responder

*/

Override func touchesBegan (touches: NSSet, withEvent event: UIEvent ){

Self. QQNumber. resignFirstResponder ()

Self. PassNumber. resignFirstResponder ()

}


}







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.