From 3ca231ed25ebb764273676b40c54f1552a20030a Mon Sep 17 00:00:00 2001 From: miguelcampiao Date: Wed, 15 Jul 2015 16:40:37 +0100 Subject: [PATCH] Updated README.md to reflect changes on the showErrorBlock method --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 727ed11..38acec8 100755 --- a/README.md +++ b/README.md @@ -83,9 +83,21 @@ CameraManager.sharedInstance.showAccessPermissionPopupAutomatically = false ``` You can even setUp your custom block to handle error messages: +It can be customised to be presented on the Window root view controller, for example. ```swift CameraManager.sharedInstance.showErrorBlock = { (erTitle: String, erMessage: String) -> Void in - UIAlertView(title: erTitle, message: erMessage, delegate: nil, cancelButtonTitle: "OK").show() + var alertController = UIAlertController(title: erTitle, message: erMessage, preferredStyle: .Alert) + alertController.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: { (alertAction) -> Void in + })) + + let topController = UIApplication.sharedApplication().keyWindow?.rootViewController + + if (topController != nil) { + topController?.presentViewController(alertController, animated: true, completion: { () -> Void in + // + }) + } + } ```