问题
I'm using rightview property to a textfield if it contains some text in it. I need to remove the property if the textfield doesn't contain any text. I have searched so many links but didn't find any answer for this. Please help me.
To add rightView property:
let cardImage = UIImageView(image: UIImage(named: icon))
cardImage.frame = CGRect(x: 10, y: 20, width: 70, height: self.cardTxtFld.frame.size.height-20);
cardImage.contentMode = UIViewContentMode.scaleAspectFit
self.cardTxtFld.rightView = cardImage;
self.cardTxtFld.rightViewMode = UITextFieldViewMode.always
来源:https://stackoverflow.com/questions/51894973/remove-rightview-property-from-textfield-swift-4