ios - MDCTextField rightView 属性在 iOS 13 上损坏
问题描述
我不能再在 iOS 13 上使用该rightView
属性MDCTextField
。我是唯一一个对此有问题的人吗?
右视图宽度覆盖整个文本字段:防止用户交互并隐藏 textView 内容。
当我从 切换MDCTextField
到时没有问题UITextField
。
解决方案
将宽度 constraint
添加到rightView
/ leftView
。
不要忘记设置translatesAutoresizingMaskIntoConstraints = false
rightView.translatesAutoresizingMaskIntoConstraints = false
rightView.widthAnchor.constraint(equalToConstant: <#NeededWidth#>).isActive = true
// This is enough to make it act like before but you can set other missing constraints like height to suppress layout warnings and prevent further issues.
// rightView.widthAnchor.constraint(equalToConstant: <#HeightOfTheTextField#>).isActive = true
您可能会在 consule 中注意到一些自动布局警告,因为您没有为rightView
/设置缺少的约束leftView
。所以添加缺少的约束或干脆忽略那些。
请注意,如果rightView
/leftView
是某种StackView
,请尝试将其放在 a 中view
,然后添加此视图。
推荐阅读
- javascript - 在 Puppeteer 中循环一组 url
- javascript - 无法启动节点应用程序(server.js,可能是 Babel 问题?)
- google-chrome - 预加载资源在 Chrome 中会转到哪个缓存
- php - 即使 PHP 中没有图像也填充提要
- php - PHP 将 mcrypt 转换为 openssl
- java - 收到队列消息后创建多个文件
- c# - 西里尔字符作为 URL 参数的问题
- ios - CAShapeLayer 为一条路径绘制不同的线宽,Swift
- javascript - 选项列表中的动态数据
- reactjs - 在 Deck.GL 中渲染多边形的最简单方法是什么?