From 5c1714c15bd10e0d5371fc416965bbb89a98e70a Mon Sep 17 00:00:00 2001 From: wangwang <398468673@qq.com> Date: Wed, 22 Apr 2020 12:35:37 +0800 Subject: [PATCH] Update DoricModalPlugin.m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit iOS的Alert风格是,左边“取消”,右边“确定” --- .../Pod/Classes/Plugin/DoricModalPlugin.m | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/doric-iOS/Pod/Classes/Plugin/DoricModalPlugin.m b/doric-iOS/Pod/Classes/Plugin/DoricModalPlugin.m index 23a42503..20c71898 100644 --- a/doric-iOS/Pod/Classes/Plugin/DoricModalPlugin.m +++ b/doric-iOS/Pod/Classes/Plugin/DoricModalPlugin.m @@ -56,12 +56,6 @@ - (void)confirm:(NSDictionary *)dic withPromise:(DoricPromise *)promise { UIAlertController *alert = [UIAlertController alertControllerWithTitle:dic[@"title"] message:dic[@"msg"] preferredStyle:UIAlertControllerStyleAlert]; - UIAlertAction *okAction = [UIAlertAction actionWithTitle:dic[@"okLabel"] ?: NSLocalizedString(@"Ok", nil) - style:UIAlertActionStyleDefault - handler:^(UIAlertAction *action) { - [promise resolve:nil]; - }]; - [alert addAction:okAction]; UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:dic[@"cancelLabel"] ?: NSLocalizedString(@"Cancel", nil) style:UIAlertActionStyleDefault @@ -69,6 +63,14 @@ - (void)confirm:(NSDictionary *)dic withPromise:(DoricPromise *)promise { [promise reject:nil]; }]; [alert addAction:cancelAction]; + + UIAlertAction *okAction = [UIAlertAction actionWithTitle:dic[@"okLabel"] ?: NSLocalizedString(@"Ok", nil) + style:UIAlertActionStyleDefault + handler:^(UIAlertAction *action) { + [promise resolve:nil]; + }]; + [alert addAction:okAction]; + [self.doricContext.vc presentViewController:alert animated:YES completion:nil]; }); } @@ -89,13 +91,6 @@ - (void)prompt:(NSDictionary *)dic withPromise:(DoricPromise *)promise { } }]; __weak typeof(alert) _alert = alert; - UIAlertAction *okAction = [UIAlertAction actionWithTitle:dic[@"okLabel"] ?: NSLocalizedString(@"Ok", nil) - style:UIAlertActionStyleDefault - handler:^(UIAlertAction *action) { - __strong typeof(_alert) alert = _alert; - [promise resolve:alert.textFields.lastObject.text]; - }]; - [alert addAction:okAction]; UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:dic[@"cancelLabel"] ?: NSLocalizedString(@"Cancel", nil) style:UIAlertActionStyleDefault @@ -105,6 +100,13 @@ - (void)prompt:(NSDictionary *)dic withPromise:(DoricPromise *)promise { }]; [alert addAction:cancelAction]; + UIAlertAction *okAction = [UIAlertAction actionWithTitle:dic[@"okLabel"] ?: NSLocalizedString(@"Ok", nil) + style:UIAlertActionStyleDefault + handler:^(UIAlertAction *action) { + __strong typeof(_alert) alert = _alert; + [promise resolve:alert.textFields.lastObject.text]; + }]; + [alert addAction:okAction]; [self.doricContext.vc presentViewController:alert animated:YES completion:nil]; });