UITextField in UIAlertController (border, backgroundColor)

前端 未结 8 1835
陌清茗
陌清茗 2020-12-01 16:38

Here is a screenshot of a UIAlertController. I was just playing around custom fonts and textfield properties but I was unable to accomplish the fol

相关标签:
8条回答
  • 2020-12-01 17:29

    Swift 3 clear version

    alertController.textFields?.forEach {
        $0.superview?.backgroundColor = .clear
        $0.superview?.superview?.subviews[0].removeFromSuperview()
    }
    
    0 讨论(0)
  • 2020-12-01 17:33

    Swift 2.0 version:

    for textField in alert.textFields! {
        if let container = textField.superview, let effectView = container.superview?.subviews.first where effectView is UIVisualEffectView {
           container.backgroundColor = UIColor.clearColor()
           effectView.removeFromSuperview()
        }
    }
    
    0 讨论(0)
提交回复
热议问题