任何人都可以告诉我一种将图像添加到UIAlertController中的方法吗?这是我为生成警报控制器而生成的代码。
我相信我需要添加子视图但不确定?
data:
代码有效但我不知道如何将图像添加到操作表中...
答案 0 :(得分:0)
您可以使用此library (MZFormSheetPresentationController)创建带有图像,按钮和许多功能的AlertViews。您可以根据需要设计viewController ......
func formSheetControllerWithNavigationController() -> UINavigationController {
return self.storyboard!.instantiateViewController(withIdentifier: "formSheetController") as! UINavigationController
}
func passDataToViewControllerAction() {
let navigationController = self.formSheetControllerWithNavigationController()
let formSheetController = MZFormSheetPresentationViewController(contentViewController: navigationController)
formSheetController.presentationController?.isTransparentTouchEnabled = false
formSheetController.presentationController?.shouldCenterVertically = true
formSheetController.presentationController?.shouldCenterHorizontally = true
formSheetController.presentationController?.shouldDismissOnBackgroundViewTap = true
let yourViewController = navigationController.viewControllers.first as! EventDisplayViewController
yourViewController.delegate = self
self.present(formSheetController, animated: true, completion: nil)
}