Tuesday 7 March 2017

HIDE PASSWORD






//
//  ViewController.swift
//  TestApp1
//
//  Created by Divakar Singh on 3/1/17.
//  Copyright (c) 2017 Divakar Singh. All rights reserved.
//

import UIKit

class ViewController: UIViewController, UITextFieldDelegate {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.view.backgroundColor = UIColor.blackColor()
        
        // make UITextField
        let myTextField: UITextField = UITextField(frame: CGRectMake(0, 0, 200, 30))
        
        // set Delegate
        myTextField.delegate = self
        
        // set boarderstyle as roundedRect
        myTextField.borderStyle = UITextBorderStyle.RoundedRect
        
        // set the position of UITextField
        myTextField.layer.position = CGPointMake(self.view.bounds.width/2, 100)
        
        // make the typing password hide
        myTextField.secureTextEntry = true
        
        // add textfield to view
        self.view.addSubview(myTextField)
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    

}

No comments:

Post a Comment