QQ Login Interface Implementation
We know that in the App store almost all the software design to the account login, and our most common is QQ, in the absence of stepping into the programmer this no way, see the interface is feeling good tall on the look.
In the process of learning, they follow the mobile phone above the app's own more curious interface to achieve a bit, today to share about the QQ login interface, completely pure code, practical storyboar too troublesome, personal comparison like the implementation of code, and almost all the login interface is almost the same, but the icon is different, Or there will be other expansion functions, but there will be other natto is not a thing.
Nonsense not much to say directly on the code
Import UIKitclassViewcontroller:uiviewcontroller {///Defining Propertiesvar qqnumber =Uitextfield () var passnumber=Uitextfield ()Overridefunc viewdidload () {Self.view.backgroundColor=Uicolor.whitecolor () super.viewdidload ( )//Add a head picture[self. addallsubviews ()]; } //Add all child controlsfunc addallsubviews () {///Avatar/var headimage = Uiimageview (Frame:cgrectmake ( -, -, -, $)) 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, +))//phonetext.text = "Please enter QQ number"//Self.view.addSubview (Phonetext) ///QQ number Input Boxvar qqnumber = Uitextfield (Frame:cgrectmake ( -, the, Uiscreen.mainscreen (). bounds.size.width- -, -)) Qqnumber.placeholder="Please enter QQ number"QQNumber.layer.borderWidth=1QQNumber.layer.borderColor=Uicolor.lightgraycolor (). Cgcolor QQNumber.layer.cornerRadius=5Qqnumber.keyboardtype=uikeyboardtype.numberpad Self.view.addSubview (qqnumber) self. Qqnumber=Qqnumber///Password entry hint //var passtext = UILabel (Frame:cgrectmake (+, Uiscreen.mainscreen (). bounds.size.width-60, ())//passtext.text = "Please enter password"//Self.view.addSubview (Passtext) ///Password Entry boxvar passnumber = Uitextfield (Frame:cgrectmake ( -, the, Uiscreen.mainscreen (). bounds.size.width- -, -)) Passnumber.placeholder="Please enter your password"PassNumber.layer.borderWidth=1PassNumber.layer.borderColor=Uicolor.lightgraycolor (). Cgcolor PassNumber.layer.cornerRadius=5Self.view.addSubview (Passnumber) self. Passnumber=Passnumber///Password Recoveryvar button = UIButton (Frame:cgrectmake ( $, the, -, -) ) Uibutton.buttonwithtype (uibuttontype.custom) button.settitle ("Forgot Password", ForState:UIControlState.Normal) Button.settitlecolor (Uicolor.lightgraycolor (), ForState:UIControlState.Norm AL) Self.view.addSubview (button) Button.addtarget (Self, Action:"OnClick", ForControlEvents:UIControlEvents.TouchUpInside)} ///Password Retrieval method implementationfunc OnClick () {///Retrieve password hintUialertview (title:"Warm Tips", Message:"The new password has been sent to the phone",Delegate: Nil, Cancelbuttontitle:"Determine", Otherbuttontitles:"Cancel"). Show ()}/** Click the interface keyboard to resign the first responder*/ OverrideFunc Touchesbegan (Touches:nsset, witheventEvent: Uievent) {self. Qqnumber.resignfirstresponder () self. Passnumber.resignfirstresponder ()}}
iOS Development--&QQ login interface for the utility of Swift article