Update DoricModalPlugin.m
iOS的Alert风格是,左边“取消”,右边“确定”
This commit is contained in:
parent
2821d42ebd
commit
5c1714c15b
@ -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];
|
||||
});
|
||||
|
Reference in New Issue
Block a user