【问题标题】:Swift alert custom show and dispense快速警报自定义显示和分配
【发布时间】:2016-11-16 14:13:53
【问题描述】:

我在 viewcontroller 中创建了一个自定义警报,遵循该问题的投票最多答案的准则: https://stackoverflow.com/a/37275840/6196609

我用它来显示警报,它被用作“加载”。

let pending = UIAlertController()

override func viewDidLoad() {
    super.viewDidLoad()

    […]

    let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let pending = storyboard.instantiateViewControllerWithIdentifier("alertaLoad")
    pending.modalPresentationStyle = UIModalPresentationStyle.OverCurrentContext
    pending.modalTransitionStyle = UIModalTransitionStyle.CrossDissolve

    […]

}

显示:

self.presentViewController(self.pending, animated: true, completion: nil)

我成功地展示了它,但我需要在我的进程结束后通过调用它的视图控制器来终止它,而不是像我引用的示例中那样单独终止它。 我已经尝试过了,但没有任何反应。

self.pending.dismissViewControllerAnimated(false, completion: { (vetor) -> Void in
                    […]
                })

我怎样才能正确地做到这一点?

【问题讨论】:

    标签: ios swift uialertview uialertcontroller


    【解决方案1】:

    在演示文稿UIViewController 上致电dismiss,而不是在演示文稿上:

    self.dismiss(animated: true) {
        // go on
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-17
      • 1970-01-01
      • 2021-12-30
      • 1970-01-01
      • 1970-01-01
      • 2020-03-21
      • 1970-01-01
      相关资源
      最近更新 更多