我需要创建这样的文本域,但是我不知道如何为rightView设置间距。

这是我尝试设置rightView图像的代码
let imageView = UIImageView(frame: CGRect(x: -10, y: -10, width: 22, height: 22))
imageView.image = UIImage(systemName: systemName)
self.rightView = imageView
self.rightViewMode = .always我尝试使用CGRect坐标和大小,但我的rightView每次看起来都是一样的
下面是我的UITextField现在的样子

发布于 2021-06-01 09:39:39
尝试使用
parentView.layoutMargins = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 8)
在parent textview上。
https://stackoverflow.com/questions/67775411
复制相似问题