From 4a1e1cfdb4a4e1a6cbf2a7433eb3b96038e75447 Mon Sep 17 00:00:00 2001 From: "Robin.Gao" Date: Thu, 19 Oct 2023 00:34:11 +0800 Subject: [PATCH] [iOS]fix UIViewController category UIAlertControllerStyleActionSheet crash for iPad; --- .../Category/UIViewController+DoraemonHierarchy.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/iOS/DoraemonKit/Src/Core/Plugin/UI/Hierarchy/Function/Category/UIViewController+DoraemonHierarchy.m b/iOS/DoraemonKit/Src/Core/Plugin/UI/Hierarchy/Function/Category/UIViewController+DoraemonHierarchy.m index cdac755e7..3a7311bb4 100644 --- a/iOS/DoraemonKit/Src/Core/Plugin/UI/Hierarchy/Function/Category/UIViewController+DoraemonHierarchy.m +++ b/iOS/DoraemonKit/Src/Core/Plugin/UI/Hierarchy/Function/Category/UIViewController+DoraemonHierarchy.m @@ -45,7 +45,14 @@ - (void)doraemon_showAlertControllerWithMessage:(NSString *)message handler:(voi } - (void)doraemon_showActionSheetWithTitle:(NSString *)title actions:(NSArray *)actions currentAction:(NSString *)currentAction completion:(void (^)(NSInteger index))completion { - UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:title preferredStyle:UIAlertControllerStyleActionSheet]; + UIAlertControllerStyle style; + if ([DoraemonAppInfoUtil isIpad]) { + style = UIAlertControllerStyleAlert; + }else{ + style = UIAlertControllerStyleActionSheet; + } + + UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:title preferredStyle:style]; for (NSInteger i = 0; i < actions.count; i++) { NSString *actionTitle = actions[i]; __block NSInteger index = i;