I'm trying to design such a button or a textfield, but exactly how can I do it? This is my textfield. I added an arrow to the right.
@IBOutlet weak var pickerTextField: UITextField!{
didSet {
pickerTextField.tintColor = UIColor.lightGray
pickerTextField.setIcon(#imageLiteral(resourceName: "drop-down-arrow"))
}
}
extension UITextField {
func setIcon(_ image: UIImage) {
let iconView = UIImageView(frame:
CGRect(x: -40, y: 7, width: 15, height: 15))
iconView.image = image
let iconContainerView: UIView = UIView(frame:
CGRect(x: -50, y: 0, width: 30, height: 30))
iconContainerView.addSubview(iconView)
rightView = iconContainerView
rightViewMode = .always
}
}