swift 添加警告框

2021-06-30  本文已影响0人  i爱吃土豆的猫

退出登录警告框

func logOutWithAlert() {
    let alertController = UIAlertController (title:  "温馨提示",message:"确定要退出吗?",preferredStyle:.alert)
    let cancelAction = UIAlertAction (title:  "取消",style:.cancel,handler:{action in
        HJPrint (message:"点击了取消")
    })
    let okAction = UIAlertAction (title:"确定" , style:.default,handler: {action in
               HJPrint (message:"点击了确定")
               AccountService.shared.signOut()
               Notification.Name.didLogout.post()
               FBTrackingService.sendData("", parameters: ["code" : FBTrackingRefs.OS_mine_exit])
     })
     alertController.addAction(cancelAction)
     alertController.addAction(okAction)
     self.present(alertController, animated: true , completion:nil )
}
上一篇下一篇

猜你喜欢

热点阅读