//提示弹窗消息并自动消失方法
func showAlertMessage(message:NSString?, duration:Float){
let alertController = UIAlertController(title: "", message: message as String?,preferredStyle:.alert)
self.present(alertController, animated: true, completion: nil)
self.perform(#selector(dimissAlert), with: alertController, afterDelay: TimeInterval(duration))
}
@objc func dimissAlert(alert:UIAlertController) {
alert.dismiss(animated: true, completion: nil)
}
一些简单的宏定义
let ScreenHeight:CGFloat = UIScreen.main.bounds.size.height//屏幕高度
let ScreenWidth:CGFloat = UIScreen.main.bounds.size.width//屏幕宽度
let NavigationHeight = (ScreenHeight == 812.0) ? 88 : 64//判断是否iPhone X,返回不同的导航栏高度