//提示彈窗消息并自動消失方法
?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,返回不同的導航欄高度