一段时间后如何显示UIAlertView? [英] How to display UIAlertView after some time?

查看:80
本文介绍了一段时间后如何显示UIAlertView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在一段时间后(例如在应用程序中执行某操作后5分钟)显示UIAlertView.我已经在通知用户该应用程序是关闭还是在后台.但我想在应用程序运行时显示UIAlertView.我不想一次又一次地刷新.三分钟后,我必须显示一些警报,例如您是否要保存?

I'm trying to display a UIAlertView after some time (like 5 minutes after doing something in the app). I'm already notifying the user if the app is closed or in a background. But I want to display a UIAlertView while the app is running. I don't want to refresh again and again. After three minutes I have to show some alert like do you want to save or not?

推荐答案

它对我有用:

self.timer = NSTimer.scheduledTimerWithTimeInterval(10.0, target: self, selector: #selector(SONGS.displayAlert), userInfo: nil, repeats: false)
func displayAlert()
{
   self.message.dismissWithClickedButtonIndex(0,animated: true)
}

这篇关于一段时间后如何显示UIAlertView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆