模拟按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)
}
})
}
posted on 2017-03-21 09:48 Walking_Jin 阅读(527) 评论(0) 收藏 举报
浙公网安备 33010602011771号