【发布时间】:2019-07-18 06:23:03
【问题描述】:
我正在尝试在我的视图控制器中显示警报框,该控制器正在使用 WKWebView 进行 web 视图。我有一个侧边菜单,我在另一个继承 UIView 的类中创建,并且侧边菜单有一个注销选项。所以我希望尽快当我点击注销选项时,侧边菜单应该从 superview 中删除并出现警报。
我创建了侧边菜单并在单击选项时删除了视图。现在我只想显示警报。但这没有发生。
func logout(){
let alert = UIAlertController(title: "", message: "Do you want to logout from the application", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Yes", style: .default, handler: nil))
alert.addAction(UIAlertAction(title: "No", style: .cancel, handler: nil))
let vc = WebViewController()
vc.present(alert, animated: true, completion: nil)
}
一旦点击注销选项,就会出现警报。
【问题讨论】:
-
如何在视图中显示 WKWebview?展示它还是推动它?
-
我在视图控制器中显示 wkwebview,但我的功能在另一个继承 UIView 的类中,并希望在 UIView 中发生注销单击后将警报显示到 Viewcontroller