Swift3.0-简单的吐司提示
利用GCD和UILabel实现,代码如下 //设置登录成功提示 let label = UILabel.init(frame: CGRect.init(x: 50,y: 667 - 30 - 64 - 64,width: 375 - 100,height: 20)) label.text = "登录成功" label.font = UIFont.systemFont(ofSize: 15) label.backgroundColor = UIColor.gray label.textAlignment = .center label.layer.cornerRadius = 4 label.layer.masksToBounds = true mtvc.view.addSubview(label)
DispatchQueue.global().async {
Thread.sleep(forTimeInterval: 2)//延时2秒执行 //回到主线程 DispatchQueue.main.async { label.removeFromSuperview() } }
_ = self.navigationController?.popToViewController(mtvc,animated: true) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |