模拟按Home键退出应用的简单方法(分享)
时间:2021-09-08 09:27:19|栏目:Android代码|点击: 次
实例如下:
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)
}
})
}
上一篇:android计算pad或手机的分辨率/像素/密度/屏幕尺寸/DPI值的方法
栏 目:Android代码
本文地址:http://www.codeinn.net/misctech/173576.html






