gpt4 book ai didi

ios - 从 MSMessagesAppViewController 正确呈现 UIAlertController

转载 作者:技术小花猫 更新时间:2023-10-29 10:27:18 25 4
gpt4 key购买 nike

我正在尝试弄清楚如何在我的 iMessage 应用程序扩展中显示样式为 UIAlertControllerStyleActionSheetUIAlertController

问题是,操作表在调用时显示在 native iMessage 文本字段下方:

[self.view.window.rootViewController presentViewController:actionSheetController animated:YES completion:NULL];

我该如何解决这个问题?

代码:

UIAlertController *actionSheetController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Clear", nil) message:nil preferredStyle:UIAlertControllerStyleActionSheet];

UIAlertAction *clear = [UIAlertAction actionWithTitle:NSLocalizedString(@"Clear", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action)
{
[self clear];
}];

UIAlertAction *cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action)
{}];

[actionSheetController addAction:clear];
[actionSheetController addAction:cancel];

[self.view.window.rootViewController presentViewController:actionSheetController animated:YES completion:NULL];

enter image description here

最佳答案

这是一个解决方法。也许添加一点动画使其流畅。

[self.view.window.rootViewController presentViewController:actionSheetController animated:YES completion:^{
actionSheetController.view.frame = CGRectOffset(actionSheetController.view.frame, 0, -40);
}];

关于ios - 从 MSMessagesAppViewController 正确呈现 UIAlertController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39759872/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com