ios - 从文本字段 swift 4 中删除 rightView 属性
问题描述
如果文本字段中包含一些文本,我将使用 rightview 属性。如果文本字段不包含任何文本,我需要删除该属性。我搜索了很多链接,但没有找到任何答案。请帮我。
添加 rightView 属性:
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
解决方案
推荐阅读
- linq - 如何将 SQL 转换为 LINQ c#(左外连接、空分配到字符串数据类型和 NVL() 转换)
- linux - 在 Docker 容器中运行 Cron 作业
- python - 如果子查询中的所有对象都具有特定值,则在 Django 2 中过滤对象
- hibernate - Spring Data JPA - 无法重用参数
- jquery - 使用 Jquery 进行 CSS 转换
- excel - 多个范围的 VBA 行
- java - 如何获取线性布局的子节点的位置?
- javascript - 我应该如何将 Lodash 过滤器方法重写为 Ramda 过滤器?
- node.js - 如何在 NodeJS 中的代理后面使用 DocumentDB
- php - Wordpress 和 AWS - Elastic Beanstalk 卡在“上传应用程序版本”中