How to change the background color of the UIAlertController?

前端 未结 10 1461
耶瑟儿~
耶瑟儿~ 2020-11-30 03:49

Due to strange behavior of UIActionSheet in iOS 8, I have implemented UIAlertController with UIAction as buttons in it. I would like to change the entire background of the U

10条回答
  •  臣服心动
    2020-11-30 04:42

    for Swift 3/ Swift 4

    let subview =(alert.view.subviews.first?.subviews.first?.subviews.first!)! as UIView
    
                subview.backgroundColor = UIColor(red: (145/255.0), green: (200/255.0), blue: (0/255.0), alpha: 1.0)
    
                alert.view.tintColor = UIColor.black
    

    .

提交回复
热议问题