Skip to main content

Add Button on UItextField in swift 3

  
 var hideShowbtn = UIButton()
hideShowbtn = UIButton(type: .custom)
        hideShowbtn.setImage(UIImage(named: "HIdeShowImg"), for: .normal)
        hideShowbtn.frame = CGRect(x: CGFloat(self.passwordTF.frame.size.width - 25), y: CGFloat(0), width: CGFloat(25), height: CGFloat(25))
        hideShowbtn.addTarget(self, action: #selector(self.refresh), for: .touchUpInside)
        self.passwordTF.rightView = hideShowbtn

        self.passwordTF.rightViewMode = .always

Happy Coding :)

Comments

Popular posts from this blog

post method using alamofire in swift 3

  func addSubscriptionApi(_completeUrl: String ) {         //HUD         Alamofire.request(_completeUrl, method:.post, parameters: nil , encoding: JSONEncoding. default , headers: nil ).responseJSON { response in             switch (response.result) {             case .success( _ ):                 if let data = response.result.value as ? NSDictionary                 {                     print(response.result.value as Any)                     print(data)                      print("SUCCESS")                  }                 break  ...

Call phone Number In swift 3

//Here you can make method of calling functionality. func callNumber (yourP honeNumber : String ) { if let phoneCallURL = URL ( string : "tel://\(yourP honeNumber )" ) { let application : UIApplication = UIApplication . shared if ( application . canOpenURL ( phoneCallURL )) { application . open ( phoneCallURL , options : [:], completionHandler : nil ) } } } Happy Coding :)