创建敬酒时注销(IOS)

问题描述 投票:0回答:1

我正在为具有用户的应用程序。其中一个功能就是让用户注销并重定向到第一页。我碰到一个用户登录时出了问题就来了,应该显示在应用程序的第一个视图“要退出”举杯消息,并从不同的网页接收的命令。基本上敬酒消息,可以与所有的美景,不仅与当前的工作。

我管理的用户注销后调用一个函数敬酒,而是因为当前视图解雇之前有一个展示它的机会就不会显示该消息。

这就是所谓的功能:

func showToast(controller: UIViewController, message : String, seconds: Double) {

    let alert = UIAlertController(title: nil, message: message, preferredStyle: .alert)
    alert.view.backgroundColor = UIColor.black
    alert.view.alpha = 0.6
    alert.view.layer.cornerRadius = 15
    controller.present(alert, animated: true)

    DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + seconds) {
        alert.dismiss(animated: true)
    }
}
ios swift view toast
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.