mapanguan

导航

< 2025年4月 >
30 31 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 1 2 3
4 5 6 7 8 9 10

统计

Swift3 使用系统UIAlertView方法做吐司效果

    

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/**
  *显示弹出信息
  */
 class func showAlertMessage(_ str:String,showtime Num:Double){
      
     let alert = UIAlertView(title: str, message: nil, delegate: nil, cancelButtonTitle: nil);
     alert.show()
     //        self.performSelector(#selector(dismissAlert(_:)), withObject: alert, afterDelay: Num)
     let dispatchTime: DispatchTime = DispatchTime.now() + Double(Int64(0.10 * Num * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)
     DispatchQueue.main.asyncAfter(deadline: dispatchTime, execute: {
         dismissAlert(alert)
     })
 }
  
 class func dismissAlert(_ alert:UIAlertView){
     alert.dismiss(withClickedButtonIndex: alert.cancelButtonIndex, animated: true)
 }

  

posted on   mapanguan  阅读(337)  评论(0)    收藏  举报

编辑推荐:
· 解锁.NET 9性能优化黑科技:从内存管理到Web性能的最全指南
· 通过一个DEMO理解MCP(模型上下文协议)的生命周期
· MySQL下200GB大表备份,利用传输表空间解决停服发版表备份问题
· 记一次 .NET某固高运动卡测试 卡慢分析
· 微服务架构学习与思考:微服务拆分的原则
阅读排行:
· 解锁.NET 9性能优化黑科技:从内存管理到Web性能的最全指南
· .net clr 8年才修复的BUG,你让我损失太多了
· 一个神奇的JS代码,让浏览器在新的空白标签页运行我们 HTML 代码(createObjectURL
· 即时通信SSE和WebSocket对比
· 做Docx预览,一定要做这个神库!!
点击右上角即可分享
微信分享提示