UITextField in UIAlertController (border, backgroundColor)

前端 未结 8 1836
陌清茗
陌清茗 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:12

    To address the situation as discussed in @Rory McKinnel and @Matthew where the superview are NULL and address modifying presented view:

    extension UIAlertController {
        override open func viewWillAppear(_ animated: Bool) {
           super.viewWillAppear(animated)
           self.textFields?.forEach {
               $0.superview?.backgroundColor = .color
               $0.superview?.superview?.subviews[0].removeFromSuperview()
           }
        }
    }
    

提交回复
热议问题