Remove rightView property from textfield swift 4

牧云@^-^@ 提交于 2019-12-11 15:19:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!