软件编程
位置:首页>> 软件编程>> Android编程>> 模拟按Home键退出应用的简单方法(分享)

模拟按Home键退出应用的简单方法(分享)

作者:jingxian  发布时间:2023-10-30 20:02:36 

标签:home键,退出

实例如下:


func exitApplication() {
   let app = UIApplication.sharedApplication().delegate as! AppDelegate
   let window = app.window
   dispatch_async(dispatch_get_main_queue(), {
     UIView.animateWithDuration(0.5, animations: {
       window!.alpha = 0
       window?.frame = CGRectMake((window?.bounds.size.width)!/2.0, (window?.bounds.size.height)!/2.0, 0, 0)
     }) { (finish) in
       exit(0)
     }
   })
 }
0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com