如何将自定义元素添加到 UIAlertController?

How I can add custom elements to UIAlertController?

请问如何才能发出如图所示的提示?

我添加了这段代码。但是如何将元素放置在正确的位置?

alert = UIAlertController(title: NSLocalizedString("AttendUpload", comment: "Идет загрузка файла, пожалуйста подождите"), message: "", preferredStyle: .alert)


    uploadingIndicator = UIActivityIndicatorView(frame: CGRect(x: 10, y: 5, width: 50, height: 50))
    uploadingIndicator!.hidesWhenStopped = true
    uploadingIndicator!.style = UIActivityIndicatorView.Style.whiteLarge
    uploadingIndicator!.startAnimating() 

    uploadingPercentage = UILabel(frame: CGRect(x: 10, y: 10, width: 200, height: 50))
    uploadingPercentage?.text = "Загружено 0%"//NSLocalizedString("Uploaded", comment: "Загружено") + "0 %"
    uploadingPercentage?.font = UIFont.preferredFont(forTextStyle: .body)
    uploadingPercentage?.textColor = UIColor.red

    self.alert!.view.addSubview(uploadingIndicator!)
    self.alert!.view.addSubview(uploadingPercentage!)

    present(alert!, animated: true, completion: nil)

Alert picture

您不应该尝试这样做。来自 docs:

The UIAlertController class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.

您应该创建自己的视图控制器。