QQ登入界面实现

我们知道在App Store中几乎所有软件都设计到账户的登入,而我们最常见的就是QQ,微信,在没有踏入程序员这条不归路之前,看到一个个的界面都感觉好高大上的样子。

在学习的过程中,自己就照着手机上面APP自己比较好奇的界面实现了一下,今天分享一下关于QQ登入界面,完全纯代码,实用StoryBoar太麻烦,个人比较喜欢用代码实现,而几乎所有登入界面几乎都是一样的,只是图标不同,或者还会有其他的拓展功能,不过这里都会了其他的纳豆不是事儿。

废话不多说,直接上代码

import UIKit

class ViewController: UIViewController {

/// 定义属性
var QQNumber = UITextField()
var PassNumber = UITextField()

    override func viewDidLoad() {

        self.view.backgroundColor = UIColor.whiteColor()
        super.viewDidLoad()

        // 添加头图片
        [self .addAllSubViews()];
    }

    // 添加所有子控件
    func addAllSubViews(){

        /// 头像
       /var headImage = UIImageView(frame: CGRectMake(, , , ))
        headImage.image =  UIImage(named:"QQ.png")
        self.view.addSubview(headImage)

        /// QQ号输入提示
       // var phoneText = UILabel(frame: CGRectMake(30, 240, UIScreen.mainScreen().bounds.size.width-60, 30))
       // phoneText.text = "请输入QQ号"
        //self.view.addSubview(phoneText)

        /// QQ号输入框
        var QQNumber = UITextField(frame: CGRectMake(, , UIScreen.mainScreen().bounds.size.width-, ))
        QQNumber.placeholder = "请输入QQ号"
        QQNumber.layer.borderWidth =
        QQNumber.layer.borderColor = UIColor.lightGrayColor().CGColor
        QQNumber.layer.cornerRadius =
        QQNumber.keyboardType = UIKeyboardType.NumberPad
        self.view.addSubview(QQNumber)
        self.QQNumber = QQNumber

        /// 密码输入提示
        //var passText = UILabel(frame: CGRectMake(30, 300, UIScreen.mainScreen().bounds.size.width-60, 30))
        //passText.text = "请输入密码"
        //self.view.addSubview(passText)

        /// 密码输入框
        var PassNumber = UITextField(frame: CGRectMake(, , UIScreen.mainScreen().bounds.size.width-, ))
        PassNumber.placeholder = "请输入密码"
        PassNumber.layer.borderWidth =
        PassNumber.layer.borderColor = UIColor.lightGrayColor().CGColor
        PassNumber.layer.cornerRadius =
        self.view.addSubview(PassNumber)
        self.PassNumber = PassNumber

        /// 密码找回
        var button = UIButton(frame: CGRectMake(, , , ))
        UIButton.buttonWithType(UIButtonType.Custom)
        button.setTitle("忘记密码", forState: UIControlState.Normal)
        button.setTitleColor(UIColor.lightGrayColor(), forState: UIControlState.Normal)
        self.view.addSubview(button)
        button.addTarget(self, action: "onClick", forControlEvents: UIControlEvents.TouchUpInside)

    }

       /// 密码找回方法实现
    func onClick(){

        ///找回密码提示
    UIAlertView(title: "温馨提示", message: "新密码已发送至手机上", delegate: nil, cancelButtonTitle: "确定", otherButtonTitles: "取消").show()
    }
    /**
    点击界面键盘辞去第一响应者
    */
    override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {

        self.QQNumber.resignFirstResponder()
        self.PassNumber.resignFirstResponder()
    }

}

iOS开发——实用篇Swift篇&QQ登入界面实现的更多相关文章

  1. ios开发——实用技术篇Swift篇&播放MP3

    播放MP3 // MARK: - 播放MP3 /*----- mp3 ------*/ //定时器- func updateTime() { //获取音频播放器播放的进度,单位秒 var cuTime ...

  2. ios开发——实用技术篇Swift篇&地址薄、短信、邮件

    //返回按钮事件 @IBAction func backButtonClick() { self.navigationController?.popViewControllerAnimated(tru ...

  3. ios开发——实用技术篇Swift篇&拍照

    拍照 // MARK: - 拍照 func fromPhotograph() { if UIImagePickerController.isSourceTypeAvailable(.Camera) { ...

  4. ios开发——实用技术篇Swift篇&照片选择

    照片选择 // MARK: - 选择照片 /*----- 选择照片 ------*/ @IBAction func addImageButtonClick() { let actionSheet = ...

  5. ios开发——实用技术篇Swift篇&系统声音

    系统声音 // MARK: - 系统声音 /*----- 系统声音 ------*/ @IBAction func systemSound() { //建立的SystemSoundID对象 var s ...

  6. ios开发——实用技术篇Swift篇&视频

    视频 // MARK: - 播放视频 /*----- 播放视频 ------*/ func moviePlayerPreloadFinish(notification:NSNotification) ...

  7. ios开发——实用技术篇Swift篇&录音

    录音 // MARK: - 录音 /*----- 录音 ------*/ var recorder:AVAudioRecorder? //录音器 var player:AVAudioPlayer? / ...

  8. ios开发——实用技术篇Swift篇&加速计和陀螺仪

    加速计和陀螺仪 //返回按钮事件 @IBAction func backButtonClick() { self.navigationController?.popViewControllerAnim ...

  9. ios开发——实用技术篇Swift篇&多点触摸与手势识别

    多点触摸与手势识别 //点击事件 var atap = UITapGestureRecognizer(target: self, action: "tapDo:") self.vi ...

随机推荐

  1. DevExpress控件XtraGrid的Master-Detail用法 z

    XtraGrid支持Master-Detail展示,在自带的Demo中展示了一个“公司——产品——订单”的例子.自己照着实现了一下,有几处关键地方补充一下. 示例: 部门信息(主1)——部门下用户(从 ...

  2. SqlServer中输出错误消息

    raiserror('所有参数都不能为空',16,1,@@error)

  3. redis集群的搭建

    1.首先下载好软件包 #cd /opt/tzr/ #wget http://redis.googlecode.com/files/redis-2.6.11.tar.gz #mkdir /opt/tzr ...

  4. CodeForce---Educational Codeforces Round 3 Load Balancing 正题

    看到这题是我的想法就是肯定跟平均值有关但是接下来就不知道怎么做了 看完大神的正解数之后,原来发现是这么简单,但是就是不知道为啥一定是平均值和平均值加1,而不是平均值和平均值减1: 好啦下面就贴出大神的 ...

  5. 【原】Storm Local模式和生产环境中Topology运行配置

    Storm入门教程 1. Storm基础 Storm Storm主要特点 Storm基本概念 Storm调度器 Storm配置 Guaranteeing Message Processing(消息处理 ...

  6. Python多线程和Python的锁

    Python多线程 Python中实现多线程有两种方式,一种基于_thread模块(在Python2.x版本中为thread模块,没有下划线)的start_new_thread()函数,另一种基于th ...

  7. Backbone.js developer 武汉 年薪8w-10w

    1.   精通Backbone.js 2.   熟练Ajax.NoSQL.RESTful APIs 3.   了解Pusher.com和 Parse.com 4.   具有良好的沟通能力,学习能力,敬 ...

  8. How to fix “X: user not authorized to run the X server, aborting.”? -摘自网络

    This is just a simple tips to solve a error message when you start your X session with “startx” comm ...

  9. 第二百八十一、二、三天 how can I 坚持

    又是三天,真搞不懂人到底是是什么,到底想要啥,好压抑. 周五,李东勇他们来北京开年会,晚上下班,去了趟团结湖公园,好冷,快冻死了,等着他们来了,见面,感觉好亲切,晚上一块吃了个火锅,玩的很happy. ...

  10. 【转】Xcode 插件优缺点对比(推荐 20 款插件)

    [转自]http://www.cnblogs.com/dsxniubility/p/5099191.html 1.Alcatraz 类似于管理第三方库的cocoapods,管理插件也有个Alcatra ...