Open KaranVakharia789 opened 3 years ago
I want to add alertView with done and cancel button but i clicked cell Logout menu at that time my current Viewcontroller popToViewController Login Screen and after show Alert but i need on done button popToViewController my code
override func viewDidLoad() { super.viewDidLoad() sideMenuController?.cache(viewControllerGenerator: { self.storyboard?.instantiateViewController(withIdentifier: "LoginVC") }, with: "1") sideMenuController?.delegate = self }
and below code in didSelectRow
let refreshAlert = UIAlertController(title: GlobalConstants.APPNAME, message: "Are you sure you want to logout?", preferredStyle: UIAlertController.Style.alert) refreshAlert.addAction(UIAlertAction(title: "Yes", style: .default, handler: { (action: UIAlertAction!) in print("Handle Ok logic here") if #available(iOS 13.0, *) { let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil) let vc = storyBoard.instantiateViewController(withIdentifier: "LoginVC") as! LoginVC self.navigationController?.popToViewController(vc, animated: true) } else { // Fallback on earlier versions let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil) let vc = storyBoard.instantiateViewController(withIdentifier: "LoginVC") as! LoginVC self.navigationController?.popToViewController(vc, animated: true) } })) refreshAlert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { (action: UIAlertAction!) in print("Handle Cancel Logic here") })) present(refreshAlert, animated: true, completion: nil)
how to implement alertview in sidemenu clicked and after ok clicked popToViewController on login page
I want to add alertView with done and cancel button but i clicked cell Logout menu at that time my current Viewcontroller popToViewController Login Screen and after show Alert but i need on done button popToViewController my code
and below code in didSelectRow