我有一个函数,当我链接到iOS 11 SDK时,我收到一个错误:
不要将子视图直接添加到视觉效果视图本身,而是将它们添加到-contentView.
这个问题可以通过改变来解决
let effectView = UIVisualEffectView(effect: UIBlurEffect(style: .dark))"
Run Code Online (Sandbox Code Playgroud)
至
effectView = UIView()
Run Code Online (Sandbox Code Playgroud)
但效果不是这样的.我怎样才能继续使用UIVisualEffectView而不是UIView?我想保持效果.
let imagePicker = UIImagePickerController()
let messageFrame = UIView()
var activityIndicator = UIActivityIndicatorView()
var strLabel = UILabel()
let effectView = UIVisualEffectView(effect: UIBlurEffect(style: .dark))
func activityIndicator(_ title: String) {
strLabel.removeFromSuperview()
activityIndicator.removeFromSuperview()
effectView.removeFromSuperview()
strLabel = UILabel(frame: CGRect(x: 50, y: 0, width: 160, height: 46))
strLabel.text = title
strLabel.font = UIFont.systemFont(ofSize: 14, weight: UIFont.Weight.medium)
strLabel.textColor = UIColor(white: 0.9, alpha: 0.7)
effectView.frame = CGRect(x: (view.frame.midX …Run Code Online (Sandbox Code Playgroud)