The QQ landing interface layout of Swift development example

Source: Internet
Author: User

//

Viewcontroller.swift

QQ Login Interface Layout

//

Created by Yue technology on 15/1/14.

Copyright (c) year BSY. All rights reserved.

//


Import UIKit


Class Viewcontroller:uiviewcontroller {

Defining Properties

var qqnumber = Uitextfield ()

var passnumber = Uitextfield ()

Override Func Viewdidload () {

Self.view.backgroundColor = Uicolor.whitecolor ()

Super.viewdidload ()

Add a head picture

[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 hint

var phonetext = UILabel (Frame:cgrectmake (+, Uiscreen.mainscreen (). bounds.size.width-60, 30))

Phonetext.text = " Please enter QQ number "

Self.view.addSubview (Phonetext)

QQ number Input box

var qqnumber = Uitextfield (Frame:cgrectmake (+, Uiscreen.mainscreen (). bounds.size.width-60, 30))

Qqnumber.placeholder = " Please enter 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 entry hint

var passtext = UILabel (Frame:cgrectmake (+, Uiscreen.mainscreen (). bounds.size.width-60, 30))

Passtext.text = " Please enter password "

Self.view.addSubview (Passtext)

Password Entry box

var passnumber = Uitextfield (Frame:cgrectmake (+, Uiscreen.mainscreen (). bounds.size.width-60, 30))

Passnumber.placeholder = " Please enter password "

PassNumber.layer.borderWidth = 1

PassNumber.layer.borderColor = Uicolor.lightgraycolor (). Cgcolor

PassNumber.layer.cornerRadius = 5

Self.view.addSubview (Passnumber)

Self. Passnumber = Passnumber

Password Recovery

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 () {

Retrieve password hint

Uialertview (title: " Warm tip ", message: "The new password has been sent to the phone ", Delegate:nil, Cancelbuttontitle: " OK ", Otherbuttontitles: " cancel "). Show ()

}

/**

Click on the interface keyboard to resign the first responder

*/

Override Func Touchesbegan (Touches:nsset, withevent event:uievent) {

Self. Qqnumber.resignfirstresponder ()

Self. Passnumber.resignfirstresponder ()

}


}







The QQ landing interface layout of Swift development example

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.