Iam using CosmicMind / Material framework trying to put an icon on the left side of the placeholder but the place holder and the image overlay each other here is my code
Txtemail.placeholder = "EmailAdress"
Txtemail.detail = "This EmailAdress is Not Valid"
Txtemail.delegate = self
Txtemail.placeholderNormalColor = Color.black
Txtemail.placeholderActiveColor = Color.pink.base
Txtemail.dividerNormalColor = Color.cyan.base
Txtemail.tag=Example.Email.rawValue
imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 20, height: 20))
image = UIImage(named: "email.png");
imageView.image = image;
Txtemail.leftViewMode = UITextFieldViewMode.always
Txtemail.leftView = imageView
and this is the result
what am i doing wrong ? thanks in advance
Try not setting the frame CGRect(x: 0, y: 0, width: 20, height: 20)
.
Try this:
let leftView = UIImageView()
leftView.image = Icon.phone?.tint(with: Color.blue.base)
textField.leftView = leftView
textField.leftViewMode = .always
Also, try the TextField Sample