So erreichen Sie den Bildschirm unter Verwendung von UITextField in swift 3 IOS.UITextField in SWIFT anpassen
-8
A
Antwort
0
wie folgt tun ...
UIImageView
hinzufügen für die linke Seite Symbolbild, Satz gewünschte Bild und Hintergrundfarbe- hinzufügen
UITextField
neben dem Imageview und legen Grenze Stil ' no border style 'im Interface Builder (Storyboard) - Stellen Sie die erforderliche Hintergrundfarbe ein
- D o die gleiche für Passwort-Feld auch, und für das Auge Symbolansicht haben einen Blick auf diese https://github.com/Sahilberi/ImageTextField
0
hinzufügen UITextField
hinzufügen subview als Imageview
Set Alpha von UITextField
Below Beispielcode für das:
func addTextField() {
let txtUserName = UITextField(frame: CGRect(x: 30, y: 70, width: 320, height: 45))
let txtPassword = UITextField(frame: CGRect(x: 30, y: 140, width: 320, height: 45))
txtUserName.backgroundColor = UIColor.black
txtPassword.backgroundColor = UIColor.black
txtUserName.alpha = 0.35
txtPassword.alpha = 0.35
let imgUser = UIImageView(frame: CGRect(x: 5, y: 5, width: 35, height: 35))
let imgKey = UIImageView(frame: CGRect(x: 5, y: 5, width: 35, height: 35))
let imgEye = UIImageView(frame: CGRect(x: txtPassword.frame.size.width - 40, y: 5, width: 35, height: 35))
imgUser.image = UIImage(named: "user")
imgKey.image = UIImage(named: "key")
imgEye.image = UIImage(named: "eye")
txtUserName.addSubview(imgUser)
txtPassword.addSubview(imgKey)
txtPassword.addSubview(imgEye)
view.addSubview(txtUserName)
view.addSubview(txtPassword)
}
0
Import UIKit
Klasse Viewcontroller: UIViewController {
@IBOutlet weak var txtpassword: UITextField!
@IBOutlet weak var txtUserName: UITextField!
@IBOutlet weak var txtView: UITextView! //your textView
override func viewDidLoad() {
super.viewDidLoad()
//navigationBarColor()
setTextFieldSpace(textField :txtUserName)
setTextFieldSpace(textField :txtpassword)
//textField border
txtpassword.borderStyle = .none
txtUserName.borderStyle = .none
}
//MARK: - Button Action
// password show hide
@IBAction func btnShowPasswordClick(_ sender: UIButton) {
if txtpassword.isSecureTextEntry{
txtpassword.isSecureTextEntry = false
}else{
txtpassword.isSecureTextEntry = true
}
}
//for set space in left side of textField
func setTextFieldSpace(textField :UITextField){
let lblSpace = UILabel()
lblSpace.frame = CGRect.init(x: 0, y: 0, width: 5, height: 5)
lblSpace.backgroundColor = .clear
textField.leftView = lblSpace
textField.leftViewMode = .always
textField.contentVerticalAlignment = .center
}
}
// this Out Check out setzen
Verwandte Themen
- 1. anpassen Breite UITextField Symbolleiste
- 2. Wie UITextField anpassen?
- 3. UITextField benutzerdefinierte Unterstreichung in Swift
- 4. UITextField Strichattribut undurchsichtig in Swift
- 5. UITextfield Zeichenanzahl Grenzen in Swift
- 6. Nur oberer UITextField Swift
- 7. Swift UITextField deleteBackward Ausgabe
- 8. Swift UITextField icon Position
- 9. UISlider zum Anpassen an UITextField Wert
- 10. Konvertieren von UITextField in String in Swift
- 11. Drag UITextField um UIView (Swift)
- 12. resignFirstResponder für UIPicker in UITextField Swift
- 13. Wie unklar UITextField sichere Texteingabe in Swift?
- 14. uitextfield in swift 3 nicht speichern
- 15. Auszug für UITextView und UITextField in Swift
- 16. Einfaches Passwort mit uitextfield in swift
- 17. Zeichen in UITextField begrenzen? - Swift/Xcode
- 18. Swift: Detecting iOS Keyboard Textersetzung in UITextField
- 19. Angeben des Umrandungsradius von UITextField in Swift
- 20. Shake Animation für UITextField/UIView in Swift
- 21. Swift-Code anpassen, um mit Swift zu arbeiten 3
- 22. Anpassen von TableViewCell mit swift
- 23. Verbinden eines UITextField mit einem SLComposeViewController - swift
- 24. Swift: UITextField kann nicht entlassen werden Tastatur
- 25. Wie man mit UITextField (Swift) interagiert
- 26. UITextField kopierbar aber nicht editierbar Swift
- 27. Wie setzt swift 3 UITextField border color?
- 28. Swift: Verschlüsselte Eingabe für UITextField für Kartendetails
- 29. Swift UIAlertController deaktivieren Return-Taste ohne UITextField
- 30. Swift UITextField adjustFontSizeToFitWidth funktioniert nicht richtig
Und was ist Ihre Frage? –
@Anil Sie möchten UITextField oder UITextView anpassen. –
Überprüfen Sie diese Antwort https://stackoverflow.com/questions/27903500/swift-add-icon-image-in-uitextfield – Arun