informatiker informatiker - 8 months ago 202
iOS Question

Swift add icon/image in UITextField

I would like to add icon/image in UITextField. The icon/image should be left to placeholder.

enter image description here

I tried this:

var imageView = UIImageView();
var image = UIImage(named: "email.png");
imageView.image = image;
emailField.leftView = imageView;



Try adding emailField.leftViewMode = UITextFieldViewMode.Always

(Default leftViewMode is Never)