【发布时间】:2018-07-01 20:09:35
【问题描述】:
在成功修改我的 UIAlertController 的颜色后,我希望对同一个 UIAlertController 中的 UITextField 执行相同的操作。但是,UITextField 周围会出现一个白色的“外边框”,我设置的边框颜色在该“外边框”内可见。
我想要的是白色“外边框”清晰/与 UIAlertController 视图背景颜色相同。
我当前的代码:
addAlert.addTextField(configurationHandler: { (textField) -> Void in
textField.placeholder = "ABC 123"
textField.textAlignment = .left
textField.backgroundColor = Theme.current.barColor
textField.textColor = Theme.current.titleColor
textField.attributedPlaceholder = NSAttributedString(string: "ABC 123", attributes: [NSAttributedStringKey.font : UIFont.systemFont(ofSize: 14, weight: .regular), NSAttributedStringKey.foregroundColor : Theme.current.subTitleColor])
textField.layer.borderWidth = 1.0
textField.layer.borderColor = Theme.current.subTitleColor.cgColor
textField.layer.backgroundColor = Theme.current.barColor.cgColor
})
UIAlertController 的屏幕截图:
提前谢谢你!
【问题讨论】:
-
我建议使用您自己的警报视图,而不是尝试自定义
UIAlertController。它不是为定制而完成的。
标签: ios swift uitextfield uikit uialertcontroller